root_toast.js 628 B

12345678910111213141516171819202122232425262728
  1. import Toast from 'react-native-root-toast';
  2. export const ShowToast = (message) => {
  3. let toast = Toast.show(message, {
  4. duration: Toast.durations.LONG,
  5. position: 0,
  6. shadow: true,
  7. animation: true,
  8. hideOnPress: true,
  9. delay: 0,
  10. onShow: () => {
  11. // calls on toast\`s appear animation start
  12. },
  13. onShown: () => {
  14. // calls on toast\`s appear animation end.
  15. },
  16. onHide: () => {
  17. // calls on toast\`s hide animation start.
  18. },
  19. onHidden: () => {
  20. // calls on toast\`s hide animation end.
  21. },
  22. });
  23. setTimeout(function() {
  24. Toast.hide(toast);
  25. }, 1500);
  26. };