react-native-easy-toast, 一款简单易用的 Toast 组件,支持 Android&iOS.
来源:互联网 发布:女子不孕不育网络咨询 编辑:程序博客网 时间:2024/06/17 18:33
原文 https://github.com/crazycodeboy/react-native-easy-toast
react-native-easy-toast
A react native module to show toast like android, it works on iOS and Android.
Content
- Installation
- Demo
- Getting started
- API
- Contribution
Installation
- 1.Run
npm i react-native-easy-toast --save
- 2.
import Toast, {DURATION} from 'react-native-toast-easy'
Demo
- Examples
Getting started
Add react-native-toast-easy
to your js file.
import Toast, {DURATION} from 'react-native-toast-easy'
Inside your component's render method, use Toast:
render() { return ( <View style={styles.container}> ... <Toast ref="toast"/> </View> ); }
Note: Add it in the bottom of the root view.
Then you can use it like this:
this.refs.toast.show('hello world!');
That's it, you're ready to go!
Basic usage
render() { return ( <View style={styles.container}> <TouchableHighlight style={{padding: 10}} onPress={()=>{ this.refs.toast.show('hello world!'); }}> <Text>Press me</Text> </TouchableHighlight> <Toast ref="toast"/> </View> ); }
Custom Toast
render() { return ( <View style={styles.container}> <TouchableHighlight style={{padding: 10}} onPress={()=>{ this.refs.toast.show('hello world!',DURATION.LENGTH_LONG); }}> <Text>Press me</Text> </TouchableHighlight> <Toast ref="toast" style={{backgroundColor:'red'}} position='top' /> </View> ); }
More Usage:
GitHubPopular
API
Contribution
Issues are welcome. Please add a screenshot of bug and code snippet. Quickest way to solve issue is to reproduce it on one of the examples.
Pull requests are welcome. If you want to change API or making something big better to create issue and discuss it first.
0 0
- react-native-easy-toast, 一款简单易用的 Toast 组件,支持 Android&iOS.
- react-native-easy-toast, 一款简单易用的 Toast 组件,支持 Android&iOS.
- 一款简单易用的 Toast 组件,支持 Android&iOS
- 一款简单易用的 Toast 组件,支持 Android&iOS
- react-native-sww-toast
- react-native-root-toast
- react-native-root-toast
- react native Toast封装
- react-native 添加 Toast 模块
- react native学习之Toast
- Android--Toast的简单封装
- ios 类似android的toast
- 支持android&ios高度自适应及JS相互调用的组件react-native-webview2
- React Native 简单的组件
- React Native调用原生模块--Toast
- React Native 自定义实现【Toast】提示框
- Android Toast 简单封装
- Android Toast 简单封装
- CentOS7.0安装Apache服务器httpd
- android studio 使用中的一些错误总结
- css
- Spring总结(二)--Bean的探究
- angular $http请求,spring mvc如何获得参数
- react-native-easy-toast, 一款简单易用的 Toast 组件,支持 Android&iOS.
- ACM程序设计书中题目--J(大写字母的更替)
- sdutacm-数据结构实验之数组二:稀疏矩阵
- 练习
- UTf-8 和 UTF-16 区别
- 记一次mysql连接数超200线上故障
- 深度学习21天实战Caffe学习笔记--笔记5--caffe中前向传播、反向传播及最优化求解过程
- 每日练习(8)
- 线程调度优先级和关联性