JSPM

react-native-cool-snackbar

1.1.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q41542F
  • License MIT

Snackbar component for react-native

Package Exports

  • react-native-cool-snackbar

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-native-cool-snackbar) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

react-native-cool-snackbar

Snackbar component for React-native

props

  • message : String!, message shown by snackbar

  • title: String!,

  • duration: Enum, ['short','long'], 'short' by default

  • error: Bool, snackbar showing error or not , false by default

  • reset: Func, called when snackbar ends (used to reset the state after message is shown)

usage

In your render method

condition is used to determine when to show the snackbar

reset is used to alter the state to conditionally show the snackbar

  reset = () =>{
    this.setState(prevState => ({ condition: !prevState.condition }));
  }
 {condition > 0 && (
    <Snackbar
      title="Sorry!,"
      duration="short"
      error
      message="no user with this email"
      reset={this.reset}
    />
  )}