use snackbars instead of toasts
This commit is contained in:
parent
dd7f1e82ba
commit
f231741789
3 changed files with 17 additions and 3 deletions
5
package-lock.json
generated
5
package-lock.json
generated
|
@ -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",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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());
|
||||
|
|
Loading…
Reference in a new issue