How to use react-native-snackbar - 10 common examples

To help you get started, we’ve selected a few react-native-snackbar examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lXSPandora / TwitterClone-RelayModern / src / components / user / Login.js View on Github external
action: {
            title: 'OK',
            color: 'rgb(0, 148, 255)',
          },
        });
        return;
      }

      await AsyncStorage.setItem('token', token); // Stores the token on the storage

      return this.startViewAnimated();
    } catch (err) {
      console.log(err.message);
      Snackbar.show({
        title: 'An unexpected error occurred',
        duration: Snackbar.LENGTH_INDEFINITE,
        action: {
          title: 'OK',
          color: 'rgb(0, 148, 255)',
        },
      });
    }
  };
github lXSPandora / TwitterClone-RelayModern / src / components / user / SignUp.js View on Github external
const token = await commit(email, name, userImage, password); //stores the token inside the token variable

      if (token == null) {
        Snackbar.show({
          title: 'Email already in use',
          duration: 3000,
          action: {
            title: 'DISMISS',
            color: 'rgb(0, 148, 255)',
            action: () => this.goToFeed(),
          },
        });
        return;
      }

      Snackbar.show({
        title: 'The user has been added! Want to make the login?',
        duration: Snackbar.LENGTH_INDEFINITE,
        action: {
          title: 'MAKE LOGIN',
          color: 'rgb(0, 148, 255)',
          action: () => this.goToFeed(token),
        },
      });
    } catch (err) {
      console.log(err.message);
      Snackbar.show({
        title: 'An unexpected error occurred',
        duration: Snackbar.LENGTH_INDEFINITE,
        action: {
          title: 'OK',
          color: 'rgb(0, 148, 255)',
github lXSPandora / TwitterClone-RelayModern / src / components / user / Login.js View on Github external
login = async (email, password) => {
    if (email === null || password === null) {
      Snackbar.show({
        title: 'Please fill all the fields',
        duration: 3000,
        action: {
          title: 'OK',
          color: 'rgb(0, 148, 255)',
        },
      });
      return;
    }
    try {
      const token = await commit(email, password); //stores the token inside the token variable

      //checking if token is null
      if (token == null) {
        Snackbar.show({
          title: 'User not Found! Please Sign Up',
github lXSPandora / TwitterClone-RelayModern / src / components / user / SignUp.js View on Github external
}

      Snackbar.show({
        title: 'The user has been added! Want to make the login?',
        duration: Snackbar.LENGTH_INDEFINITE,
        action: {
          title: 'MAKE LOGIN',
          color: 'rgb(0, 148, 255)',
          action: () => this.goToFeed(token),
        },
      });
    } catch (err) {
      console.log(err.message);
      Snackbar.show({
        title: 'An unexpected error occurred',
        duration: Snackbar.LENGTH_INDEFINITE,
        action: {
          title: 'OK',
          color: 'rgb(0, 148, 255)',
        },
      });
    }
  };
github lXSPandora / TwitterClone-RelayModern / src / components / user / SignUp.js View on Github external
if (token == null) {
        Snackbar.show({
          title: 'Email already in use',
          duration: 3000,
          action: {
            title: 'DISMISS',
            color: 'rgb(0, 148, 255)',
            action: () => this.goToFeed(),
          },
        });
        return;
      }

      Snackbar.show({
        title: 'The user has been added! Want to make the login?',
        duration: Snackbar.LENGTH_INDEFINITE,
        action: {
          title: 'MAKE LOGIN',
          color: 'rgb(0, 148, 255)',
          action: () => this.goToFeed(token),
        },
      });
    } catch (err) {
      console.log(err.message);
      Snackbar.show({
        title: 'An unexpected error occurred',
        duration: Snackbar.LENGTH_INDEFINITE,
        action: {
          title: 'OK',
          color: 'rgb(0, 148, 255)',
        },
      });
github josephroquedev / campus-guide / src / containers / discover / StudySpots.tsx View on Github external
const studySpotInfo = this.state.studySpots;
    if (studySpotInfo == undefined) {
      return;
    }

    this.setState({ filterSelected: true });
    this.props.showSearch(true);

    const filterId = id;
    if (filterId) {
      const filterName = Translations.getName(studySpotInfo.filterDescriptions[filterId]) || '';
      if (this.props.activeFilters == undefined) {
        this.props.setFilters([ filterId ]);
      } else if (this.props.activeFilters.has(filterId)) {
        this.props.deactivateFilter(filterId);
        Snackbar.show({
          duration: Snackbar.LENGTH_SHORT,
          title: `${Translations.get('filter_removed')}: ${filterName}`,
        });
      } else {
        this.props.activateFilter(filterId);
        Snackbar.show({
          duration: Snackbar.LENGTH_SHORT,
          title: `${Translations.get('filter_added')}: ${filterName}`,
        });
      }
    } else {
      this.props.setFilters([]);
    }
  }
github RSG-Group / RSG-Chess-mobile / src / components / CheckmateSnackBar.js View on Github external
componentDidUpdate(prevProps) {
    if (this.props.checkmate !== prevProps.checkmate && this.props.checkmate) {
      Snackbar.show({
        title: strings.gameOver[this.props.lang],
        duration: Snackbar.LENGTH_INDEFINITE,
        action: {
          title: strings.takeLook[this.props.lang],
          color: "green",
          onPress: () => {
            this.props.navigate("Play");
          }
        }
      });
    }
  }
github jsamr / react-native-render-html-table-bridge / examples / simple / Example.js View on Github external
onLinkPress: (e, url) => {
      Snackbar.show({
        title: url,
        color: 'white'
      })
    }
};
github Mokkapps / rebelgamer-mobile-app / src / App.js View on Github external
showToast = message => {
    Snackbar.show({
      title: message,
      duration: Snackbar.SHORT,
    });
  };
github lXSPandora / TwitterClone-RelayModern / src / components / tweetsFeed / Feed.js View on Github external
render={({ error, props }) => {
      if (error) {
        return Snackbar.show({
          title: 'An unexpected error occurred',
          duration: Snackbar.LENGTH_INDEFINITE,
          action: {
            title: 'OK',
            color: 'rgb(0, 148, 255)',
          },
        });
      } else if (props) {
        return ;
      }
      return (

react-native-snackbar

Material Design "Snackbar" component for Android and iOS.

MIT
Latest version published 3 months ago

Package Health Score

75 / 100
Full package analysis