New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-native-tm

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-tm

Customizable toast component for react-native applications. Supported on ios and android.

  • 1.0.11
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-71.43%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-tm

Fully customizable toast component for your react-native applications supported on IOS and Android. Also you can use it with expo or pure react-native.

ezgif com-gif-maker (8)

Installation

expo: expo install react-native-tm
npm: npm i react-native-tm
yarn: yarn add react-native-tm

Basic usage

import Toast from "react-native-tm";

export default function YourComponent() {
   return(
      <YourComponentsHere></YourComponentsHere>
      <Toast
        show={true}
        withClose={true}
        style={{
          toast: {
            width: '100%',
            height: 50,
            backgroundColor: 'red'
          }
        }}
      />
   )
}

// more about customizing below

How customize your toast ?

import Toast from "react-native-tm";

export default function YourComponent() {
   
   return(
      <YourComponentsHere></YourComponentsHere>
      <Toast
        show={true}
        // set the animation type of toast choose the best for you in props
        animationType={'bounce'}
        // add the closing toast function on press
        withClose={true}
        // pass toast styles object to style
        style={{
          toast: {
            width: '100%',
            height: 50,
            backgroundColor: 'red'
          }
        }}
      >
        // and for sure you can add childrens here
        // to customize your toast 
        <View style={{height: 50, width: 50, backgroundColor: 'black', borderRadius: 30}}/>
        <View
          style={{
              marginLeft: 10
          }}
        >
            <Text>
                  Title top
            </Text>
            <Text>
                  Description on the bottom
            </Text>
        </View>
      </Toast>
   )
}

How customize your animation ?

By default toast use the linear animation, just show and hide nothing special. But if you want to change the animation type use description below.

For bounce animation.
     <Toast
        ...
         // Add the animation type bounce
        animationType={'bounce'}
       ...
      />
drawing
For elastic animation.
     <Toast
        ...
         // Add the animation type elastic
        animationType={'elastic'}
       ...
      />
drawing

Props

Below are the props you can pass to the React Component.

PropTypeDefaultExampleDescription
showbooleanshow={true}Put the toast state
animationTypestringanimationType={'bounce'}If you what different animations on your toast
toastOnPressfunctiontoastOnPress={() => console.log('check')}You can add many other functions here or just navigate to other screen
withClosebooleanfalsewithClose={true}Added posibility to close toast on press. You can use it with toastOnPress at one time.
childrencomponent<Toast><YourComponent/></Toast>You can add yout own component for example messages from users in your app or internet connection notifications.
styleobject{toast: {backgroundColor: 'black', height: 50}}The styles object for styling the toast details. More about styling in Custom styling step.
showingDurationint8000showingDuration={3000}How much time toast will show on the screen
statusBarHeightint180statusBarHeight={150}If you have a specific status bar on your device you may want to pass this props to aware some UI bugs on the device
onHidefunctiononHide={() => yourFunctionToDoSomething()}Function which call when toast hiding.

ToDos

  1. TypeScript support.
  2. More animation for customizing.

Keywords

FAQs

Package last updated on 01 Mar 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc