Coder Social home page Coder Social logo

msdgwzhy6 / react-native-smart-tip Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mochixuan/react-native-smart-tip

1.0 2.0 0.0 213 KB

react-native smart tip, including Toast、Modal、SnackBar

JavaScript 89.40% Python 2.93% Java 2.15% Objective-C 5.52%

react-native-smart-tip's Introduction

react-native-smart-tip

React-native smart tip, including Toast、Modal、SnackBar

GitHub license npm

Installation

yarn add react-native-smart-tip
or
npm i react-native-smart-tip --save 

Features

Usage

WToast
import {WToast} from 'react-native-smart-tip'

// Base 
show = () => {
	WToast.show({data: 'hello world'})
}

// Other
show = () => {
	const toastOpts = {
	    data: 'Success',
	    textColor: '#ffffff',
	    backgroundColor: '#444444',
	    duration: WToast.duration.LONG, //1.SHORT 2.LONG
	    position: WToast.position.TOP, // 1.TOP 2.CENTER 3.BOTTOM
	    icon: <Image source={require('../data/img/success.png')} style={{width: 32,height: 32,resizeMode: 'contain'}}/>
	}
	
	WToast.show(toastOpts)
}

WToast API
Props Type Required Default Description
data String true ' ' Displayed content
duration Number false WToast.duration.SHORT The duration of the toast
position Number false WToast.position.BOTTOM Displayed position
inEasing Easing false Easing.elastic(1) Admission animation
textColor String false 'white' font color
backgroundColor String false 'black' background color
icon Component fasse undefined Image to be displayed

WSnackBar
import {WSnackBar} from 'react-native-smart-tip'

// Base 
show = () => {
	WSnackBar.show({data: 'hello world'})
}

// Other
show = () => {
	const snackBarOpts = {
	    data: 'Please check the network first.',
	    position: WSnackBar.position.BOTTOM, // 1.TOP 2.CENTER 3.BOTTOM
	    duration: WSnackBar.duration.LONG, //1.SHORT 2.LONG 3.INDEFINITE
	    textColor: '#ff490b',
	    backgroundColor: '#050405',
	    actionText: 'Sure',
	    actionTextColor: '#ff490b',
	    actionClick: ()=>{
	    	// Click Action
	    },
	}
	
	WSnackBar.show(snackBarOpts)
}

WSnackBar API
Props Type Required Default Description
data String true ' ' Displayed content
statusBarHeight Number false -1 Prevent Android statusBar
height Number false 44 Height to display
duration Number false WSnackBar.duration.SHORT The duration of the toast
position Number false WSnackBar.position.BOTTOM Displayed position
inEasing Easing false Easing.linear Admission animation
textColor String false 'white' font color
backgroundColor String false 'black' background color
actionText String false undefined action text
actionTextColor String false 'white' action text color
actionClick Function false undefined listener click

WModal
import {WModal} from 'react-native-smart-tip'

// Base 
show = () => {
	WModal.show({data: 'hello world'})
}

// Other
show = () => {
	const modalOpts = {
	    data: 'Loading',
	    textColor: '#fff',
	    backgroundColor: '#444444',
	    position: WModal.position.CENTER,
	    icon: <ActivityIndicator color='#fff' size={'large'}/>
	}
	
	WModal.show(modalOpts)
}

WToast API
Props Type Required Default Description
data String true ' ' Displayed content
position Number false WToast.position.BOTTOM Displayed position
inEasing Easing false Easing.elastic(1) Admission animation
textColor String false 'white' font color
backgroundColor String false 'black' background color
icon Component fasse undefined Image to be displayed
onRequestClose Function false undefined Android Back
MIT Licensed

react-native-smart-tip's People

Contributors

mochixuan avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.