Giter Site home page Giter Site logo

devbabs / react-native-toast-alert Goto Github PK

View Code? Open in Web Editor NEW
9.0 1.0 0.0 2.6 MB

An awesome package for cool toast alerts in react-native ๐Ÿš€

License: MIT License

JavaScript 21.16% TypeScript 78.84%
react react-native react-native-alert react-native-alert-notification react-native-component react-native-toast react-native-toast-message react-native-toast-android react-native-toast-ios

react-native-toast-alert's Introduction

react-native-toast-alert

An awesome package for cool toast alerts in react-native ๐Ÿš€

Toast.success("Welcome. you will definitely love this toast package.๐Ÿ˜‰")

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

Option Description Type Default Value
duration How long the toast will be visible for (milliseconds) number 2000
progress Show progress bar boolean false
bounce Add bounce effect while showing toast boolean false
autoDismiss Dismiss toast automatically boolean true
centerText Align the text in the toast centrally boolean false
dismissMode How 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


react-native-toast-alert's People

Contributors

devbabs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.