npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-tm

v1.0.11

Published

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

Downloads

41

Readme

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'}
       ...
      />

For elastic animation.

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

Props

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

| Prop | Type | Default | Example | Description | | ------------- | ------------- | ------------- | ------------- | ------------- | | show | boolean | | show={true} | Put the toast state | | animationType | string | | animationType={'bounce'} | If you what different animations on your toast | | toastOnPress | function | | toastOnPress={() => console.log('check')} | You can add many other functions here or just navigate to other screen | | withClose | boolean | false | withClose={true} | Added posibility to close toast on press. You can use it with toastOnPress at one time. | | children | component | | <Toast><YourComponent/></Toast> | You can add yout own component for example messages from users in your app or internet connection notifications. | | style | object | | {toast: {backgroundColor: 'black', height: 50}} | The styles object for styling the toast details. More about styling in Custom styling step.| | showingDuration | int | 8000 | showingDuration={3000} | How much time toast will show on the screen | | statusBarHeight | int | 180 | statusBarHeight={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 | | onHide | function | | onHide={() => yourFunctionToDoSomething()} | Function which call when toast hiding. |

ToDos

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