React Native cross-plateform toast notification component highly customizable

React Native cross-plateform toast notification component highly customizable

React Native Toast .React Native cross-plateform (iOS/Android) toast notification component highly customizable.

React Native Toast

React Native cross-plateform (iOS/Android) toast notification component highly customizable.

Installation

npm install rn-toast

or with yarn

yarn add rn-toast

Usage

to use toast first wrap your application or screen with toast like shown before

import Toast from "rn-toast";

// app.tsx, index or whatever component is used as initial component

const App = () => <Toast>
    // rest of your application logi
    // <Navigation/>
</Toast>

then you can show toast any where in your app, see Configuration section to see available parameters you can pass into show function

export default function HomeScreen() {
  const showDefault = () => {
    Toast.show({
      title: 'test',
      duration: 2000,
      position: 'top',
      animation: 'slide-bottom',
    });
  };

  return (
    <Toast>
      <View style={styles.container}>
        <Button title={'show'} onPress={showDefault} />
      </View>
    </Toast>
  );
}

the toast will be automatically hidden after given duration, but if you want the hide it before that you can call hide function

 const hideDefault = () => {
    Toast.hide()
  };

Configuration

option description required default value
duration Time until the toast gets closed false 2000
title title to show in toast false ''
message title to show in toast false ''
type type of toast, available values are default, error, success, warning, info false default
position position of toast, available values are bottom, top false bottom
animation animation type of toast, available values are scale, fade, slide-up, slide-bottom, see Animations section custom animations false scale
style see Styling section to make your custom styles, see Styling section to more details false {}

you can pass this configurations in show method, or you can specify default configs as <Toast configs={configs}

const configs = {
    duration: 3000,
    position: 'top',
    animation: 'fade'
}

const App = () => <Toast>
    // rest of your application logi
    // <Navigation/>
</Toast>

// other things

Toast.show({
    // this will override configs.duration
    duration: 2000,
    // this will override configs.position
    position: 'bottom'
})

Styling

you can pass your custom styles in configs as an object with 3 keys, container, message, title, for example below styling will make your toast more like native ToastAndroid

 Toast.show({
      message: 'test',
      position: 'bottom',
      animation: 'fade',
      duration: 3000,

      style: {
        container: {
          backgroundColor: '#eeeeee',
          paddingVertical: 15,
          bottom: 35,
        },
        message: {
          color: '#000',
          fontSize: 13,
          lineHeight: 12,
        },
      },
    });

Animations

Contributing

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

Download Details:

Author: thevsstech

Source Code: https://github.com/thevsstech/rn-toast

react react-native mobile-apps

Bootstrap 5 Complete Course with Examples

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

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

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 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.

Which is the best React Native app development company in New York?

Hire top react native app development company in New York to build and develop custom react native mobile apps for Android & iOS with the latest features.