rn-simple-toast

1.0.1 • Public • Published

rn-simple-toast

React Native Toast component for both iOS and Android

Add it to your project

  1. Insall package
    • Using NPM npm i -S rn-simple-toast
    • Using Yarn yarn add rn-simple-toast
  2. Import package import { Toast, DURATION, POSTION } from 'rn-simple-toast';

Usage

import React from 'react';
import { Toast, DURATION  } from 'rn-simple-toast';
class App extends React.Component  {
    render() {
        return (
            <View style={styles.container}>
                <Toast ref={_ref => this.toastRef = _ref} />
                <Button
                    onPress={() => {
                        toastRef.show('Some message here', '#3498db', DURATION.LONG);
                    }}
                    title='Show message'
                    style={{ width: 120, backgroundColor: 'darkviolet' }}
                    textColor='#fff'
                />
            </View>
        );
    }
}
DEMO

iOS Android

Props

  • duration (String) - Duration time to display message.
  • containerStyle (String) Style of toast container.
  • textStyle (Function) - Style of text message
  • position (String) - Message display position
  • positionOffset (String) - Distance from top or bottom to display message

Method

  • show - The method to show toast message

MIT Licensed

Package Sidebar

Install

npm i rn-simple-toast

Weekly Downloads

24

Version

1.0.1

License

MIT

Unpacked Size

5.11 kB

Total Files

3

Last publish

Collaborators

  • xuho95