博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
react-native-easy-toast, 一款简单易用的 Toast 组件,支持 Android&iOS.
阅读量:4084 次
发布时间:2019-05-25

本文共 1960 字,大约阅读时间需要 6 分钟。

原文  

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

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 (             
...
); }

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 (            
{ this.refs.toast.show('hello world!'); }}>
Press me
); }

Custom Toast

render() {        return (            
{ this.refs.toast.show('hello world!',DURATION.LENGTH_LONG); }}>
Press me
); }

More Usage:

API

Props Type Optional Default Description
style View.propTypes.style true {backgroundColor: 'black',opacity: OPACITY,borderRadius: 5,padding: 10,} Custom style toast
position PropTypes.oneOf(['top','center','bottom',]) true 'bottom' Custom toast position
Method Type Optional Description
show(text, duration) function false show a toast
close() function true Close toast early

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.

转载地址:http://eueni.baihongyu.com/

你可能感兴趣的文章
MODULE_DEVICE_TABLE的理解
查看>>
platform_device与platform_driver
查看>>
platform_driver平台驱动注册和注销过程(下)
查看>>
.net强制退出主窗口的方法——Application.Exit()方法和Environment.Exit(0)方法
查看>>
c# 如何调用win8自带的屏幕键盘(非osk.exe)
查看>>
build/envsetup.sh 简介
查看>>
linux怎么切换到root里面?
查看>>
安装alien,DEB与RPM互换
查看>>
编译Android4.0源码时常见错误及解决办法
查看>>
Android 源码编译make的错误处理
查看>>
linux环境下C语言中sleep的问题
查看>>
ubuntu 12.04 安装 GMA3650驱动
查看>>
新版本的linux如何生成xorg.conf
查看>>
xorg.conf的编写
查看>>
启用SELinux时遇到的问题
查看>>
virbr0 虚拟网卡卸载方法
查看>>
No devices detected. Fatal server error: no screens found
查看>>
新版本的linux如何生成xorg.conf
查看>>
Centos 6.0_x86-64 终于成功安装官方显卡驱动
查看>>
Linux基础教程:CentOS卸载KDE桌面
查看>>