Created
December 27, 2020 17:18
-
-
Save ShanikaNishadhi/bfc834a9ae32c820c7b7c4a406892771 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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