1.1.0 • Published 7 years ago
rn-notification v1.1.0
rn-notification
Install
npm install rn-notification
How to use
Import the rn-notification
component.
import Notification from 'rn-notification'
Add the <Notification />
component to the bottom of your render method:
render() {
return (
<View>
...
<Notification ref={(ref) => { this.notification = ref; }} />
</View>
)
}
Make sure to create a ref to the component by adding ref={(ref) => { this.notification = ref; }}
as a prop.
To display the notification, call .show
on the component ref created above.
this.notification.show("Last name is required");
Example
import Notification from 'rn-notification';
...
class MyApp extends Component {
handlePress = () => {
this.notification.show('Last name is required')
}
render() {
return (
<View>
<Text>Welcome!</Text>
<TouchableOpacity onPress={this.handlePress}>
<Text>Trigger notification</Text>
</TouchableOpacity>
...
<Notification ref={(ref) => { this.notification = ref; }} />
</View>
)
}
}
Future Plans
- Support custom styling (e.g. background color) via props.
- Predefined notification types - Error, Alert, Warning.
- Handle messages that are larger than one line.
Contributing
Issues are welcome. If you have new features, requests, or would like to contribute feel free to open a PR and get in touch.
License
rn-notification is MIT licensed
1.1.0
7 years ago
1.1.0-beta.2
7 years ago
1.1.0-beta.1
7 years ago
1.1.0-beta.0
7 years ago
1.0.0
7 years ago