All Projects → crazycodeboy → React Native Easy Toast

crazycodeboy / React Native Easy Toast

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

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to React Native Easy Toast

Toastify Js
Pure JavaScript library for better notification messages
Stars: ✭ 570 (-42.42%)
Mutual labels:  toast
Anylayer
Android稳定高效的浮层创建管理框架
Stars: ✭ 745 (-24.75%)
Mutual labels:  toast
Burnttoast
Module for creating and displaying Toast Notifications on Microsoft Windows 10.
Stars: ✭ 796 (-19.6%)
Mutual labels:  toast
Gsmessages
A simple style messages/notifications, in Swift.
Stars: ✭ 595 (-39.9%)
Mutual labels:  toast
Sweet Alert
A BEAUTIFUL, RESPONSIVE, CUSTOMIZABLE, ACCESSIBLE (WAI-ARIA) REPLACEMENT FOR JAVASCRIPT'S POPUP BOXES FOR LARAVEL
Stars: ✭ 696 (-29.7%)
Mutual labels:  toast
Vue Toastification
Vue notifications made easy!
Stars: ✭ 747 (-24.55%)
Mutual labels:  toast
Dtoast
同学,你的系统Toast可能需要修复一下!Fix Your Android Toast!
Stars: ✭ 556 (-43.84%)
Mutual labels:  toast
Androidutilcode
AndroidUtilCode 🔥 is a powerful & easy to use library for Android. This library encapsulates the functions that commonly used in Android development which have complete demo and unit test. By using it's encapsulated APIs, you can greatly improve the development efficiency. The program mainly consists of two modules which is utilcode, which is commonly used in development, and subutil which is rarely used in development, but the utils can be beneficial to simplify the main module. 🔥
Stars: ✭ 30,239 (+2954.44%)
Mutual labels:  toast
Toasty
The usual Toast, but with steroids 💪
Stars: ✭ 6,279 (+534.24%)
Mutual labels:  toast
Laravel Notify
Flexible Flash notifications for Laravel
Stars: ✭ 787 (-20.51%)
Mutual labels:  toast
Fftoast
A very powerful iOS message notifications and AlertView extensions. It can be easily realized from the top of the screen, the bottom of the screen and the middle of the screen pops up a notification. You can easily customize the pop-up View.
Stars: ✭ 649 (-34.44%)
Mutual labels:  toast
Devutils
🔥 ( 持续更新,目前含 160+ 工具类 ) DevUtils 是一个 Android 工具库,主要根据不同功能模块,封装快捷使用的工具类及 API 方法调用。该项目尽可能的便于开发人员,快捷、高效开发安全可靠的项目。
Stars: ✭ 680 (-31.31%)
Mutual labels:  toast
Vue Snotify
Vuejs 2 Notification Center
Stars: ✭ 755 (-23.74%)
Mutual labels:  toast
Popupview
Toasts and popups library written with SwiftUI
Stars: ✭ 581 (-41.31%)
Mutual labels:  toast
React Toastify
React notification made easy 🚀 !
Stars: ✭ 8,113 (+719.49%)
Mutual labels:  toast
Cogo Toast
Beautiful, Zero Configuration, Toast Messages for React. Only ~ 4kb gzip, with styles and icons
Stars: ✭ 557 (-43.74%)
Mutual labels:  toast
Universaltoast
简洁优雅可点击的toast控件,无BadTokenException风险,关闭通知权限依然正常显示。An elegant and flexible toast which can handle click event , avoid BadTokenException and run fine without notification permission
Stars: ✭ 748 (-24.44%)
Mutual labels:  toast
Fluttertoast
Android Toast Plugin for Flutter
Stars: ✭ 957 (-3.33%)
Mutual labels:  toast
Sneaker
A lightweight Android library for customizable alerts
Stars: ✭ 928 (-6.26%)
Mutual labels:  toast
Notie
🔔 a clean and simple notification, input, and selection suite for javascript, with no dependencies
Stars: ✭ 6,170 (+523.23%)
Mutual labels:  toast

react-native-easy-toast

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

release PRs Welcome NPM version License MIT 语言 中文

Content

Installation

  • 1.Run npm i react-native-easy-toast --save
    • or yarn add react-native-easy-toast
  • 2.import Toast, {DURATION} from 'react-native-easy-toast'

Demo

Screenshots

Getting started

Add react-native-easy-toast to your js file.

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

Inside your component's render method, use Toast:

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

Note: Be sure to add Toast to the bottom of the root view.

Then you can use it like this:

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

That's it, you're ready to go!

show a toast, and execute callback function when toast close it:

this.toast.show('hello world!', 500, () => {
    // something you want to do at close
});

Show a toast forever until you manually close it:

this.toast.show('hello world!', DURATION.FOREVER);

Or pass an element:

this.toast.show(<View><Text>hello world!</Text></View>);
 // later on:
 this.toast.close('hello world!');

Optional you can pass a delay in seconds to the close()-method:

 this.toast.close('hello world!', 500);

Currently, the default delay for close() in FOREVER-mode is set to 250 ms (or this.props.defaultCloseDelay, which you can pass with)

 <Toast ... defaultCloseDelay={100} />

Basic usage

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

Custom 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>
    );
}

More Usage:

GitHubPopular

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
positionValue React.PropTypes.number true 120 Custom toast position value
fadeInDuration React.PropTypes.number true 500 Custom toast show duration
fadeOutDuration React.PropTypes.number true 500 Custom toast close duration
opacity React.PropTypes.number true 1 Custom toast opacity
textStyle View.propTypes.style true {color:'white'} Custom style text
Method Type Optional Description
show(text, duration, callback, onPress) function false show a toast,unit is millisecond,and do callback
close() function - start the close timer

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.


MIT Licensed

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].