Add Notifications to Your React Native App with Ease

Add Notifications to Your React Native App with Ease

Add notifications to your React Native app with ease. toastify-react-native allows you to add notifications to your react-native app (ios, android) with ease. No more nonsense!

toastify-react-native

🎉 toastify-react-native allows you to add notifications to your react-native app (ios, android) with ease. No more nonsense!

Demo

View examples on snack.expo.io

20210515_231132

Features

  • Smooth enter/exit animations
  • Plain simple and flexible APIs
  • Resize itself correctly on device rotation
  • Swipeable
  • Easy to set up for real, you can make it work in less than 10sec!
  • Super easy to customize
  • RTL support
  • Swipe to close 👌
  • Can choose swipe direction
  • Super easy to use an animation of your choice. Works well with animate.css for example
  • Define behavior per toast
  • Pause toast by click on the toast 👁
  • Fancy progress bar to display the remaining time
  • Possibility to update a toast
  • You can control the progress bar a la nprogress 😲
  • You can display multiple toast at the same time
  • Dark mode 🌒
  • And much more !

Installation

$ npm install toastify-react-native

The gist

import React, { useState } from 'react';
import { Button } from 'react-native';
import Toast from 'toastify-react-native';

export default function App() {
  const [toastify, setToastify] = useState()

  return (
    <View>
      <Toast ref={(c) => setToastify(c)} />

      <Button onPress={() => toastify.success("Success")} />
    </View>
  );

}

A complete example

import React, { useState } from 'react';
import { StyleSheet, View, TouchableOpacity, Text } from 'react-native';
import Toast from 'toastify-react-native';

export default function App() {
  const [toastify, setToastify] = useState()
  const [toastify2, setToastify2] = useState()
  const [toastify3, setToastify3] = useState()

  const showToasts = async () => {
    toastify.success("Success");
    toastify2.info("Some info");
    toastify3.error("This is an Error");
  }

  return (
    <View style={styles.container} >
      {/* Toasts */}
      <Toast ref={(c) => setToastify(c)} />
      <Toast position="center" animationStyle="fancy" ref={(c) => setToastify2(c)} />
      <Toast position="bottom" animationStyle="rightInOut" ref={(c) => setToastify3(c)} />

      {/* Button */}
      <TouchableOpacity style={{ marginTop: 200, backgroundColor: "white", borderColor: "green", borderWidth: 2, padding: 10 }} onPress={() => showToasts()} >
        <Text>
          SHOW SOME AWESOMENESS !
        </Text>
      </TouchableOpacity>
    </View>
  );

}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  }
});

For a more complex example take a look at the /example directory.

Available props

Name Type Default Description
width number 256 Width of toast
height number 68 Height of the toast
style any null Style applied to the toast
position top, center or bottom top Position of toast
positionValue number 50 position value of toast
duration number 3000 The display time of toast.
animationStyle rightInLeftOut, rightInOut or fancy rightInLeftOut The animation style of toast
animationIn string or object 'slideInRight' Toast show animation
animationOut string or object 'slideOutLeft' Toast hide animation
animationInTiming number 300 Timing for the Toast show animation (in ms)
animationOutTiming number 300 Timing for the toast hide animation (in ms)
backdropTransitionInTiming number 300 The backdrop show timing (in ms)
backdropTransitionOutTiming number 300 The backdrop hide timing (in ms)
hasBackdrop bool false Render the backdrop
backdropColor string 'black' The backdrop background color
backdropOpacity number 0.5 The backdrop opacity when the toast is visible

|

Available animations

Take a look at react-native-animatable to see the dozens of animations available out-of-the-box.

Acknowledgements

Pull requests, feedbacks and suggestions are welcome!

Download Details:

Author: zahidalidev The Demo/Documentation: View The Demo/Documentation Download Link: Download The Source Code Official Website: https://github.com/zahidalidev/toastify-react-native License: MIT licensed and built with ❤️ by Zahid Ali.

react-native mobile-apps

What is Geek Coin

What is GeekCash, Geek Token

Best Visual Studio Code Themes of 2021

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

How native is React Native? | React Native vs Native App Development

Article covers: How native is react native?, React Native vs (Ionic, Cordova), Similarities and difference between React Native and Native App Development.

React Native App Developers India, React Native App Development Company

Hire React Native app developers India from a preferred React Native app development company by innovative industry leaders. Let's Discuss Your Project.

React Native Mobile App Development

Skenix is providing React Native Development Services with qualified React Native App Developers. Get the best React Native App Development Services.

How React Native Is Shaping Mobile App Development

Are you a mobile app developer looking for more efficient tools for your projects? Mobile app development is getting tougher and tougher as the market continues to grow. As a developer, you need to develop Apps which meet the demands of your users. To achieve this, adopt the right tools, like the React Native development framework.

Top React Native Mobile App Development Companies in USA

Looking for top React Native mobile app development company in USA for Startups & Enterprise? Find out the top list of React Native mobile app development company in USA.