All Projects → netyouli → react-native-whc-toast

netyouli / react-native-whc-toast

Licence: MIT license
A react native module to show toast alert, it works on iOS and Android.

Programming Languages

javascript
184084 projects - #8 most used programming language
objective c
16641 projects - #2 most used programming language
python
139335 projects - #7 most used programming language
java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to react-native-whc-toast

toaster-android
A simple library to add custom toast to android applications.
Stars: ✭ 22 (+10%)
Mutual labels:  toast
mosha-vue-toastify
A light weight and fun Vue 3 toast or notification or snack bar or however you wanna call it library.
Stars: ✭ 185 (+825%)
Mutual labels:  toast
bs5-utils
A JavaScript utility package for Bootstrap 5 components.
Stars: ✭ 26 (+30%)
Mutual labels:  toast
vercel-toast
💬 Framework-agnostic vercel design's toast component (≈1KB Gzipped)
Stars: ✭ 67 (+235%)
Mutual labels:  toast
iOSUtilitiesSource
IOS Utilities Library for Swift
Stars: ✭ 46 (+130%)
Mutual labels:  toast
ASToast
A Swift extension for using Android style Toast notifications.
Stars: ✭ 34 (+70%)
Mutual labels:  toast
React-Toast
Custom push notification (Toast) implementation under React + stayed by TailwindCSS.
Stars: ✭ 74 (+270%)
Mutual labels:  toast
react-awesome-toasts
Toast notifications for react.
Stars: ✭ 64 (+220%)
Mutual labels:  toast
TastyToasty
An easy-to-use library to create tasty 😋 Toasts with a bunch of flavours 🌈. It also provides effortless methods to create Instagram like Toasts 💓
Stars: ✭ 54 (+170%)
Mutual labels:  toast
xxy
xxy xxy.js alert 移动端弹窗 弹窗 上拉加载 下拉刷新 移动端UI 轮播 banner
Stars: ✭ 84 (+320%)
Mutual labels:  toast
fusion
An Easy-to-use Kotlin based Customizable Modules Collection with Material Layouts by BlackBeared.
Stars: ✭ 39 (+95%)
Mutual labels:  toast
smart-webcomponents-community
Material & Bootstrap Web Components built with Smart
Stars: ✭ 30 (+50%)
Mutual labels:  toast
Toaster-Library
🎫 Android library, Custom toast and dialog (2018)
Stars: ✭ 14 (-30%)
Mutual labels:  toast
flutter easyloading
✨A clean and lightweight loading/toast widget for Flutter, easy to use without context, support iOS、Android and Web
Stars: ✭ 1,021 (+5005%)
Mutual labels:  toast
MaterialDesign-Toast
Custom android Toast with Material Design
Stars: ✭ 70 (+250%)
Mutual labels:  toast
AckBar
AckBar is a very lightweight and customizable android library to display brief message to user.
Stars: ✭ 14 (-30%)
Mutual labels:  toast
jh-weapp-demo
微信小程序项目- 实现一些常用效果、封装通用组件和工具类
Stars: ✭ 60 (+200%)
Mutual labels:  toast
learnwithjason.dev
Boop Crew HQ
Stars: ✭ 101 (+405%)
Mutual labels:  toast
QuickWebKit
A great & strong plugin based WebViewController. 一款基于插件的 WebView 视图控制器,您可以基于它设计您的浏览器插件,然后像积木一样来组装它们。
Stars: ✭ 29 (+45%)
Mutual labels:  toast
vue2-dialog
A mobile Vue plugin for VueDialog
Stars: ✭ 21 (+5%)
Mutual labels:  toast

react-native-whc-toast

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

release PRs Welcome NPM version License MIT 语言 中文

Content

Installation

  • 1.Run npm install react-native-whc-toast --save
  • 2.import Toast from 'react-native-whc-toast'

Demo

Screenshots

Getting started

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

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

Inside your component's render method, use Toast:

 render() {
         return (
             <View style={styles.container}>
                 ...
                 <Toast ref="toast"/>
             </View>
         );
 }

Then you can use it like this:

1.default display bottom:

 /// alert toast bottom
 this.refs.toast.show('hello toast');
 /// or
 this.refs.toast.showBottom('hello toast');

2.display top:

 /// alert toast bottom
 this.refs.toast.showTop('hello toast');
 /// or
 this.refs.toast.show('hello toast', Toast.Duration.long, Toast.Position.top);

3.display center:

 /// alert toast center
 this.refs.toast.showCenter('hello toast');
 /// or
 this.refs.toast.show('hello toast', Toast.Duration.long, Toast.Position.center);

Basic usage

render() {
        return (
            <View style={styles.container}>
                <TouchableHighlight
                    onPress={()=>{
                        this.refs.toast.show('hello toast');
                    }}>
                    <Text>Start Toast</Text>
                </TouchableHighlight>
                <Toast ref="toast"/>
            </View>
        );
    }

Custom Toast

render() {
        return (
            <View style={styles.container}>
                <TouchableHighlight
                    onPress={()=>{
                        this.refs.toast.show('hello toast', Toast.Duration.long, Toast.Position.bottom);
                    }}>
                    <Text>Start toast</Text>
                </TouchableHighlight>
                <Toast
                    ref="toast"
                    style = {styles.toast}
                    textStyle = {styles.text},
                    position = {Toast.Position.bottom}
                    fadeInDuration = {300}
                    fadeOutDuration = {300}
                    duration = {Toast.Duration.long}
                    opacity = {0.9}
                    positionValue = {100}
                />
            </View>
        );
    }

API

Position Description
Position.top toast show top
Position.center toast show center
Position.bottom toast show bottom
Duration Description
Duration.short toast default show short duration
Position.long toast default show long duration
Position.infinite toast alway show
Props Type Optional Default Description
style ViewPropTypes.style true {} Custom default toast style
textStyle Text.propTypes.style true {} Custom default toast text style
position Toast.Position true Toast.Position.bottom Custom default toast show position
fadeInDuration PropTypes.number true 300 Custom default toast fade in duration
fadeOutDuration PropTypes.number true 300 Custom default toast fade out duration
duration Toast.Duration true Toast.Duration.long Custom default toast show duration
opacity PropTypes.number true 0.9 Custom default toast fade in or fade out opacity animation
positionValue PropTypes.number true 100 Custom default toast show top, bottom margin
Method Type Optional Description
show(message, duration, position) function true show toast custom position default bottom
showTop(message, duration) function true show toast top
showCenter(message, duration) function true show toast center
showBottom(message, duration) function true show toast bottom
close(isNow) function true hide toast

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].