react-native-dj-toast

daojia react-native-dj-toast

Usage no npm install needed!

<script type="module">
  import reactNativeDjToast from 'https://cdn.skypack.dev/react-native-dj-toast';
</script>

README

Toast

accordion

Install

npm i --save react-native-dj-toast

Usage

Using in your app will usually look like this:

import React, { Component } from 'react';
import {
  AppRegistry,
  StyleSheet,
  Text,
  View,
  TouchableHighlight,
} from 'react-native';

import Toast from 'react-native-dj-toast';


export default class NPMTest extends Component {

    render() {
      let icons = [require('./images/success_black.png'), require('./images/error_black.png')];
      return (
        <View style={{marginTop:20}}>
          <TouchableHighlight onPress={()=>this.refs.toast.show('This is a toast!')}>
            <Text>click me</Text>
          </TouchableHighlight>
          <Toast ref="toast" icons={icons}/>
        </View>
      );
    }
}

AppRegistry.registerComponent('xxx', () => NPMTest);

Props

The following props can be used to modify the style and/or behaviour:

Prop Type Opt/Required Default Note

Methods

The following methods can be used to open and close the Dialog:

Method Parameters Note
show message:需要显示的信息,time:toast显示的时长,默认为2000ms time可不传,默认为2000ms