toast.js 678 B

1234567891011121314151617181920212223242526
  1. import React, {Component} from 'react';
  2. // import {View, Button, Overlay} from 'react-native';
  3. import {Toast} from '@ant-design/react-native';
  4. // 弹出toast层
  5. //参数 type: 1:默认信息层
  6. // message:显示的信息
  7. // const ToastOverlay = Overlay.Toast;
  8. export const ToastShow = (type, message) => {
  9. if (type === 1) {
  10. // return Overlay.show(message);
  11. return Toast.success(message, 1);
  12. }
  13. if (type === 2) {
  14. return Toast.success(message, 1);
  15. }
  16. if (type === 3) {
  17. return Toast.fail(message);
  18. }
  19. if (type === 4) {
  20. return Toast.info(message, 1);
  21. }
  22. if (type === 5) {
  23. return Toast.offline('Network connection failed !!!');
  24. }
  25. };