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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@quec/react-native-easy-toast

v2.1.2

Published

A react native module to show toast like android, it works on iOS and Android.

Readme

react-native-easy-toast

一款简单易用的 Toast 组件,支持 Android&iOS。

release PRs Welcome NPM version License MIT language English

目录

安装

  • 1.在终端运行 npm i react-native-easy-toast --save
    • 或者 yarn add react-native-easy-toast
  • 2.在要使用Toast的js文件中添加import Toast, {DURATION} from 'react-native-easy-toast'

Demo

Screenshots

如何使用?

第一步:

在你的js文件中导入 react-native-easy-toast

import Toast, {DURATION} from 'react-native-easy-toast'

第二步:

将下面代码插入到render()方法中:

 render() {
     return (
         <View>
             ...
            <Toast ref={(toast) => this.toast = toast}/>
         </View>
     );
 }

注意: 请将<Toast ref={(toast) => this.toast = toast}/> 放在最外层View的底部。

第三步:

使用:

 this.toast.show('hello world!');

在需要弹出提示框时使用上面代码即可。

或者像这样

this.toast.show(<View><Text>hello world!</Text></View>);

用例

render() {
return (
    <View>
        <Button title={'Press me'} onPress={()=>{
            this.toast.show('hello world!',2000);
        }}/>
        <Toast ref={(toast) => this.toast = toast}/>
    </View>
);
    }

自定义 Toast

render() {
    return (
        <View>
            <Button title={'Press me'} onPress={()=>{
                    this.toast.show('hello world!',2000);
                }}/>
            <Toast
                ref={(toast) => this.toast = toast}
                style={{backgroundColor:'red'}}
                position='top'
                positionValue={200}
                fadeInDuration={750}
                fadeOutDuration={1000}
                opacity={0.8}
                textStyle={{color:'red'}}
            />
        </View>
    );
}

更多用例:

GitHubPopular

API

属性 | 类型 | 可选 | 默认值 | 描述 ----------------- | -------- | -------- | ----------- | ----------- style | View.propTypes.style | true | {backgroundColor: 'black',opacity: OPACITY,borderRadius: 5,padding: 10,} | 自定义Toast的样式 position | PropTypes.oneOf(['top','center','bottom',]) |true | 'bottom' | 自定义Toast的位置 positionValue | React.PropTypes.number | true | 120 | 自定义Toast的位置 fadeInDuration | React.PropTypes.number | true | 500 | 自定义 toast淡入时间 fadeOutDuration | React.PropTypes.number | true | 500 | 自定义 toast淡出时间 opacity | React.PropTypes.number | true | 1 | 自定义 toast 的透明度 textStyle | View.propTypes.style | true | {color:'white'} | 自定义text的样式

方法 | 类型 | 可选 | 描述 ----------------- | -------- | -------- | ----------- | ----------- show(text, duration, callback, onPress) | function | false | 弹出提示框,单位是毫秒 close() | function | true | 手动关闭提示框

贡献

欢迎大家提Issues。如果能为Issues配一个异常或报错的截图,能帮助我快速的定位问题和解决问题。
另外欢迎大家Pull requests,为项目贡献的智慧。


MIT Licensed
大家可以自由复制和转载。