0.2.7 • Published 9 months ago

react-native-toast-alert v0.2.7

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

react-native-toast-alert

An awesome package for cool toast alerts in react-native 🚀

Toast.success("Welcome. you will definitely love this toast package.😉")

View Live Demo

Installation

npm install react-native-toast-alert

Usage

👉🏽 Step 1

Import ToastManager and Toast.

// ...
import ToastManager { Toast } from 'react-native-toast-alert'

👉🏽 Step 2

Add ToastManager component to the top of your app component structure.

const App = () => {
  return (
    <View>
      <ToastManager />
      <App>
        // Other parts of your application content can go here
      </App>
    </View>
  )
})

👉🏽 Step 3 (Final Step)

Call any of the Toast methods directly

const App = () => {
  // ...

  const showSuccessToast = () => {
    Toast.success("Yaay!!! You made it here...🚀🚀🚀")
  }

  const showErrorToast = () => {
    Toast.error("Error, looks like something went wrong.🙁")
  }

  const showInfoToast = () => {
    Toast.info("Hi, you're still online.")
  }

  const showWarningToast = () => {
    Toast.warning("Your wallet balance is running low.")
  }

  return (
    <View>
      <ToastManager />
      <Touchable
        onPress={() => showSuccessToast()}
      >
        Show
      </Touchable>
    </View>
  )
})

// ...

Note:

Each of the methods on the toast take 2 parameters: The toast message and an optional list of configuration options.

Options for Configuraton

OptionDescriptionTypeDefault Value
durationHow long the toast will be visible for (milliseconds)number2000
withIconIf there should be an icon in the alertbooleantrue
iconCustom icon image. Works only if withIcon is set to trueImageSourcePropTypeundefined
progressShow progress barbooleanfalse
bounceAdd bounce effect while showing toastbooleanfalse
autoDismissDismiss toast automaticallybooleantrue
centerTextAlign the text in the toast centrallybooleanfalse
dismissModeHow to dismiss the toast manually. (This is useful if you set autoDismiss to false)'tap' or 'swipe'tap

Happy Coding 🥂

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


0.2.7

9 months ago

0.2.6

9 months ago

0.2.3

9 months ago

0.2.5

9 months ago

0.2.4

9 months ago

0.2.2

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.8

1 year ago

0.1.7

1 year ago

0.1.9

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago