react-native 구성 요소 (2) -- (react-native-root-toast)

1314 단어
react-native-root-toast - 부동 알림(SVProgressHUD와 유사) 설치 npm install react-native-root-toast --save 간단한 봉인
/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 * @flow
 */
'use strict'

import Toast from 'react-native-root-toast'
let JSToast={

}

JSToast.show=(message)=>{
    // Add a Toast on screen.
    let toast = Toast.show(message, {
        duration: Toast.durations.LONG,
        position: Toast.positions.CENTER, //      BOTTOM,TOP
        shadow: true,
        animation: true,
        hideOnPress: true,
        delay: 0,
        onShow: () => {
            // calls on toast\`s appear animation start
        },
        onShown: () => {
            // calls on toast\`s appear animation end.
        },
        onHide: () => {
            // calls on toast\`s hide animation start.
        },
        onHidden: () => {
            // calls on toast\`s hide animation end.
        }
    });

// You can manually hide the Toast, or it will automatically disappear after a `duration` ms timeout.
    setTimeout(function () {
        Toast.hide(toast);
    }, 2000);
}
module.exports = JSToast;


사용
import Toast from '../Common/JSToast' //    

//               
Toast.show('    ');

좋은 웹페이지 즐겨찾기