Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Promise Rejected in AddCalendarEvent.presentEventCreatingDialog #104

Open
Ali1Ab opened this issue May 15, 2020 · 3 comments
Open

Promise Rejected in AddCalendarEvent.presentEventCreatingDialog #104

Ali1Ab opened this issue May 15, 2020 · 3 comments

Comments

@Ali1Ab
Copy link

Ali1Ab commented May 15, 2020

I'm trying to add an event in google calendar and promise is rejected with error:
[Unhandled promise rejection: TypeError: null is not an object (evaluating 'AddCalendarEvent.presentEventCreatingDialog')]

My Code:

 static addToCalendar = (title, startDateUTC, endUTC) => {
   const eventConfig = {
     title,
     startDate: moment.utc(startDateUTC).format('YYYY-MM-DDTHH:mm:ss.SSS[Z]'),
     endDate: moment.utc(endUTC).format('YYYY-MM-DDTHH:mm:ss.SSS[Z]'),
     navigationBarIOS: {
       tintColor: "orange",
       backgroundColor: "green",
       titleColor: "blue"
       }
   };
   console.log(eventConfig)
   // Object {
   //   "endDate": "2020-04-30T00:00:00.000Z",
   //   "navigationBarIOS": Object {
   //     "backgroundColor": "green",
   //     "tintColor": "orange",
   //     "titleColor": "blue",
   //   },
   //   "startDate": "2020-04-01T00:00:00.000Z",
   //   "title": "test media33333333",
   // }
   console.log(AddCalendarEvent.presentEventCreatingDialog) //  [Function presentEventCreatingDialog]
 
 
 AddCalendarEvent.presentEventCreatingDialog(eventConfig).then((eventInfo) => {
   console.log(JSON.stringify(eventInfo));
 }, ()=>{console.log("Promise Rejected")}) //this is showing
 .catch((error) => {
   // handle error such as when user rejected permissions
   console.warn(error);
 });
};

I saw issue #88 (comment) but it didn't work.
Please help me

@tnluan
Copy link

tnluan commented Jun 7, 2020

Please try to remove react-native-calendar-events out of your package.json, just add react-native-add-calendar-event
It works for me

@Ali1Ab
Copy link
Author

Ali1Ab commented Jun 8, 2020

I did but it didn't work.

@pbortnick
Copy link

pbortnick commented Dec 12, 2020

Try

  1. cd ios
  2. pod update
  3. react-native run-ios

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants