react-native-toaster
Simple top-pop toast feedback messages for React Native, also Redux compatible
Example
Properties
Prop | Default | Type | Description |
---|---|---|---|
message | - | object / array |
The current toast message to display (see below). Multiple messages are shown one at a time after each other. |
onShow | null | func |
Callback called when a message is shown, passed the message as the first parameter |
onHide | null | func |
Callback called when a message is hidden, passed the message as the first parameter |
onPress | null | func |
Callback called when the user press a message, passed the message as the first parameter |
message
Prop | Default | Type | Description |
---|---|---|---|
text | - | string / node |
Text message to display, or custom element (see below) |
styles | ToastStyles.info | object |
Styles for the container and text (see below) |
duration | 3000 | number |
Duration in ms the toast is shown for |
height | 100 | number |
Height of the toast message |
onShow | null | func |
Callback called when this message is shown |
onHide | null | func |
Callback called when this message is hidden |
onPress | null | func |
Callback called when this message is pressed |
text
The text
property can be either a simple string or a custom element to be rendered. If a string is passed, it is wrapped in a container View
and Text
element:
Both the container View
and Text
element can be styled using the styles
property.
styles
An object used to style the container View
and Text
elements when message.text
is a string
. Defaults to ToastStyles.info
if not set and should look like this:
Example with Redux
App.jsx
LoginForm.jsx
redux/actions.js
redux/reducers.js