diff --git a/package-lock.json b/package-lock.json index 86a711d..f279649 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8186,6 +8186,11 @@ "debounce": "^1.2.0" } }, + "react-native-snackbar": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/react-native-snackbar/-/react-native-snackbar-1.0.2.tgz", + "integrity": "sha512-VOpF7/fUdv32zVH+CW542wpFYGtvAw+nFVloJu0HJWGeClB6V/GcxgAADQOEReOw91RnQkr+bZk0aEf4UXZ64w==" + }, "react-native-speedometer": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/react-native-speedometer/-/react-native-speedometer-1.0.3.tgz", diff --git a/package.json b/package.json index 9f03d9e..e7a9a92 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "react-native-password-strength-meter": "^0.0.2", "react-native-phone-input": "lbryio/react-native-phone-input", "react-native-reanimated": "1.2.0", + "react-native-snackbar": "1.0.2", "react-native-super-grid": "^3.0.4", "react-native-vector-icons": "^6.6.0", "react-native-video": "lbryio/react-native-video#exoplayer-lbry-android", diff --git a/src/component/AppNavigator.js b/src/component/AppNavigator.js index e496631..a28da3c 100644 --- a/src/component/AppNavigator.js +++ b/src/component/AppNavigator.js @@ -62,6 +62,7 @@ import NavigationButton from 'component/navigationButton'; import discoverStyle from 'styles/discover'; import searchStyle from 'styles/search'; import SearchRightHeaderIcon from 'component/searchRightHeaderIcon'; +import Snackbar from 'react-native-snackbar'; const SYNC_GET_INTERVAL = 1000 * 60 * 5; // every 5 minutes @@ -364,7 +365,7 @@ class AppWithNavigationState extends React.Component { this.setState({ verifyPending: false }); NativeModules.Firebase.track('email_verified', { email: user.primary_email }); - ToastAndroid.show(__('Your email address was successfully verified.'), ToastAndroid.LONG); + Snackbar.show({ title: __('Your email address was successfully verified.'), duration: Snackbar.LENGTH_LONG }); // get user settings after email verification this.getUserSettings(); @@ -381,7 +382,7 @@ class AppWithNavigationState extends React.Component { const { toast, emailToVerify, emailVerifyPending, emailVerifyErrorMessage, user } = nextProps; if (toast) { - const { message } = toast; + const { message, isError } = toast; let currentDisplayType; if (!currentDisplayType && message) { // default to toast if no display type set and there is a message specified @@ -389,7 +390,14 @@ class AppWithNavigationState extends React.Component { } if (currentDisplayType === 'toast') { - ToastAndroid.show(message, ToastAndroid.LONG); + const props = { + title: message, + duration: Snackbar.LENGTH_LONG, + }; + if (isError) { + props.backgroundColor = Colors.Red; + } + Snackbar.show(props); } dispatch(doDismissToast());