mirror of
https://github.com/zhigang1992/react-native-firebase.git
synced 2026-01-12 22:50:20 +08:00
[notifications] Fix flow type
This commit is contained in:
@@ -181,7 +181,7 @@ export default class Notifications extends ModuleBase {
|
||||
* Returns an array of all scheduled notifications
|
||||
* @returns {Promise.<Array>}
|
||||
*/
|
||||
getScheduledNotifications(): Promise<Object[]> {
|
||||
getScheduledNotifications(): Promise<Notification[]> {
|
||||
return getNativeModule(this).getScheduledNotifications();
|
||||
}
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ const init = async () => {
|
||||
);
|
||||
channel.setDescription('test channel');
|
||||
RNfirebase.notifications().android.createChannel(channel);
|
||||
RNfirebase.notifications().cancelAllNotifications();
|
||||
|
||||
const remoteInput = new RNfirebase.notifications.Android.RemoteInput(
|
||||
'inputText'
|
||||
@@ -71,9 +72,15 @@ const init = async () => {
|
||||
setTimeout(() => {
|
||||
RNfirebase.notifications().displayNotification(notification);
|
||||
notification.setNotificationId('scheduled');
|
||||
RNfirebase.notifications().scheduleNotification(notification, {
|
||||
fireDate: date.getTime(),
|
||||
});
|
||||
RNfirebase.notifications()
|
||||
.scheduleNotification(notification, {
|
||||
fireDate: date.getTime(),
|
||||
})
|
||||
.then(() => {
|
||||
RNfirebase.notifications()
|
||||
.getScheduledNotifications()
|
||||
.then(notifications => console.log('scheduled: ', notifications));
|
||||
});
|
||||
}, 5);
|
||||
} catch (error) {
|
||||
console.error('messaging init error:', error);
|
||||
|
||||
Reference in New Issue
Block a user