rn-simple-toast
React Native Toast component for both iOS and Android
Add it to your project
- Insall package
- Using NPM
npm i -S rn-simple-toast
- Using Yarn
yarn add rn-simple-toast
- 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
Props
duration
(String) - Duration time to display message.containerStyle
(String) Style of toast container.textStyle
(Function) - Style of text messageposition
(String) - Message display positionpositionOffset
(String) - Distance from top or bottom to display message
Method
show
- The method to show toast message
MIT Licensed