[notifications] Fix flow type

This commit is contained in:
Chris Bianca
2018-03-09 11:15:27 +00:00
parent e537955212
commit 287ad216cf
2 changed files with 11 additions and 4 deletions

View File

@@ -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();
}

View File

@@ -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);