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-tiny-toast

v1.0.7

Published

😊A react native toast like component , it works on IOS and Android.

Downloads

2,740

Readme

react-native-tiny-toast

A react native toast like component , it works on IOS and Android.

release PRs Welcome NPM version License MIT

Features

  1. Support iPhone X, XS, XS Max & XR
  2. Support both Android and IOS.
  3. Custom icon and style and so on.
  4. Use native ActivityIndicator.

Demo

Screenshots

Install

npm i react-native-tiny-toast --save
or
yarn add react-native-tiny-toast

Getting started

import Toast from 'react-native-tiny-toast'

Toast.show('This is a default toast')

Toast.showSuccess('Pay success')

Toast.show('Custom toast',{
  position: Toast.position.center,
  containerStyle:{},
  textStyle: {},
  imgSource: require('xxx'),
  imgStyle: {},
  mask: true,
  maskStyle:{},
  ...
})

const toast = Toast.showLoading('Loading...')
setTimeout(() => {
  // Recommend
  Toast.hide(toast) 
  // or Toast.hide()
  // If you don't pass toast,it will hide the last toast by default.
 }, 3000)
    
Using a Component
import React, {Component} from 'react-native'
import Toast from 'react-native-tiny-toast'

class Example extends Component {
    state={
      visible: false
    }
    
    componentDidMount() {
        setTimeout(() => this.setState({
            visible: true
        }), 1000); 

        setTimeout(() => this.setState({
            visible: false
        }), 3000);
    };

    render() {
        return 
        <Toast
            visible={this.state.visible}
            position={50}
            onHidden={()=>{
              // onHidden
            }}>This is a message
        </Toast>
    }
}

Api

Name | Default | Type | Description --------------------|--------------------------|----------------------|--------------------------- containerStyle | null | ViewPropTypes.style | Custom container style duration | Toast.durations.SHORT | Number | Toast duration(ms), won't disappear if value is 0 delay | 0 | Number | The delay duration before toast start appearing on screen. animationDuration | 200 | Number | Animation duration visible | false | Boolean | Show toast. (Only for Toast Component) position | Toast.position.bottom | Number | 0 means the middle of the screen.A negative number indicates the distance to the bottom of the screen.A positive number indicates the distance to the top of the screen. animation | true | Boolean | Whether to enable fade animation shadow | false | Boolean | Whether to enable shadow shadowColor | #000 | String | Shadow color(don't support android) showText | true | Boolean | Whether to show text textColor | #fff | String | Text color textStyle | null | Text.propTypes.style | Text style mask | false(true when showLoading) | Boolean | Whether to enable mask maskColor | rgba(0,0,0,0.3) | String | Mask background color maskStyle | null | ViewPropTypes.style | Mask style imgSource | null | Image.source | Image source imgStyle | null | Image.propTypes.style| Image style loading | false(true when showLoading) | Boolean | Whether to show loading indicatorSize | large | String or Number | Set the ActivityIndicator size,Currently only specific values can be set on Android. onHidden | null | Function | Triggered when toast's hide animation end onMaskPress | null | Function | Triggered when the mask is clicked

Method | Type | Description ---------------------------|----------|------------------- show(text, options) | Function | Show a toast showSuccess(text, options) | Function | Show a toast with success icon showLoading(text, options) | Function | Show a toast with ActivityIndicator hide(toast) | Function | If you don't pass toast,it will hide the last toast by default.

MIT Licensed