1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- /**
- * Created by zack on 2017/5/8.
- */
- import Toast from 'react-native-root-toast'
-
-
- const ToastMsg = {
- show: (msg, durationSet) => {
- let message = msg
- let time = 2000
- if (durationSet === 2000) {
- time = 2000
- }else if (durationSet === 3000) {
- time = 3000
- }else if (durationSet === 4000) {
- time = 4000
- }else if (durationSet === 5000) {
- time = 5000
- }else if (durationSet === 6000) {
- time = 6000
- }else if (durationSet === 7000) {
- time = 7000
- }else if (durationSet === 8000) {
- time = 8000
- }else if (durationSet === 9000) {
- time = 9000
- }else if (durationSet === 10000) {
- time = 10000
- }else {
- time = 2000
- }
-
- const messageParam = {
- duration: time,
- position: Toast.positions.CENTER,
- shadow: true,
- animation: true,
- hideOnPress: false,
- delay: 0,
- }
- let toast = Toast.show(message, messageParam);
-
- // You can manually hide the Toast, or it will automatically disappear after a `duration` ms timeout.
- // setTimeout(function () {
- // Toast.hide(toast);
- // }, 10000);
- }
- }
-
- export default ToastMsg
|