React Native Modal Notifier
![license MIT](https://img.shields.io/badge/license-MIT-brightgreen)
react-native-modal-notifier is a third party in-app notification package! It provides modal notification popup.
There are more than one usage example;
- Can be triggered by
useEffect
function - Can be triggered by user action
- Can be triggered by api service data
Installation
yarn add react-native-modal-notifier
Or
npm install --save react-native-modal-notifier
Usage
Wrap your app with NotifierContainer
import { NotifierContainer } from 'react-native-modal-notifier';
const App = () => (
<NotifierContainer>
<HomeScreen />
</NotifierContainer>
);
Then import useNotifier
anywhere in your code/screen/components
import { useNotifier } from 'react-native-modal-notifier';
const HomeScreen = () => {
const notifier = useNotifier();
useEffect(() => {
alert && notifier({
title: alert.title,
message: alert.message
});
}, [alert]);
return (
<TouchableHighlight
onPress={() =>
notifier({
title: 'New Notification',
message:
'New Notification',
})
}>
<Text>Set Notification</Text>
</TouchableHighlight>
);
};
Props of useNotifier
Prop Name | Prop Description | Data Type | Required |
---|
title | Title of the message | string | yes |
message | The message of the content | string | yes |