Skip to content

Instantly share code, notes, and snippets.

@ShanikaNishadhi
Created December 27, 2020 17:18
Show Gist options
  • Save ShanikaNishadhi/bfc834a9ae32c820c7b7c4a406892771 to your computer and use it in GitHub Desktop.
Save ShanikaNishadhi/bfc834a9ae32c820c7b7c4a406892771 to your computer and use it in GitHub Desktop.
import PushNotificationIOS from '@react-native-community/push-notification-ios'
const showNotifications = (title, message) => {
PushNotificationIOS.presentLocalNotification({
alertTitle: title,
alertBody: message,
});
};
const handleScheduleNotifications = (title, message) => {
const date = new Date();
date.setSeconds(date.getSeconds() + 5)
PushNotification.localNotification({
alertTitle: title,
alertBody: message,
fireDate: date.toISOString,
});
};
const handleCancel = () => {
PushNotificationIOS.removeAllDeliveredNotifications();
}
export { showNotifications, handleScheduleNotifications , handleCancel };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment