wix / react-native-notifications

React Native Notifications
MIT License
3.22k stars 761 forks source link

Fix API Documentation so that postLocalNotification works - Includes fix #1010

Open UberMC opened 9 months ago

UberMC commented 9 months ago

I urgently suggest updating API so basic implementation works :) On page https://wix.github.io/react-native-notifications/docs/localNotifications

The fireDate requires it to be .toISOString(), new Date() is not sufficient


 let currentTime = new Date();
  let newTime = new Date(currentTime.getTime() + 10000); // Add 10 seconds
  let isoString = newTime.toISOString();

  Notifications.postLocalNotification({
    body: 'Local notification!',
    title: 'Local Notification Title',
    sound: 'chime.aiff',
    category: 'SOME_CATEGORY',
    link: 'localNotificationLink',
    fireDate: isoString
  }, 1);

The current example in API

let localNotification = Notifications.postLocalNotification({
    body: "Local notification!",
    title: "Local Notification Title",
    sound: "chime.aiff",
    silent: false,
    category: "SOME_CATEGORY",
    userInfo: { },
    fireDate: new Date(),
});

results in react-native-error

Screenshot 2023-11-09 at 5 47 55 PM
patgoley-tts commented 2 months ago

fireDate doesn't seem to be available in the latest version of the library. Any idea what happened to it?