Closed ldco2016 closed 3 years ago
@wmcmahan , could you at least tell me under what circumstance const status = await RNCalendarEvents.authorizationStatus();
would return undetermined
for a React Native version 0.60.4 version but not for a 0.53.3 version, despite the user being the same?
So I was able to get react-native-calendar-events
working on the iOS side via a refactor, but it still does not save an event on the Android side.
I was able to get it to work for Android with RN v0.61.4 by removing all of the manual hacks that the instructions say to do. With auto-linking, seems to work without all of those coding hacks to the gradle files and the *.java files. It also seems to work fine with iOS.
I have the code working in debug, but not in release, even if I removed all the hacks :/ Any update on a version compatible with react native 0.61?
Same here, everything works as expected in debug, but when you release version, Promise returns error Unable to save event.
Ok, I found out that this issue is about start and end dates. You just need to pass them in timestamp format and then it works even in release version.
timestamp format, got it, thanks! will try it.
@voslartomas , could you share an example of how you are passing them in timestamp format for it to save in Android side?
Sure it looks like this.
startDate: new Date(eventObject.date).getTime(),
@voslartomas Does using new Date(eventObject.date).toISOString() work for you? Using .getTime() and .toISOString() give me the error if "Unhandled Promise Rejection (id:1), RangeError: Invalid Date toISOString@[native code]
@voslartomas can you also send a full example of your working code?
@voslartomas using startDate: new Date(eventObject.date).getTime() give me the error "Malformed calls fromJS: field sizes are different."
I am on version 1.7.3
I use moment(mydate).toISOString() and this works well for me for iOS and Android, in React Native v0.61.4
If it helps, I put together some code samples of a helper class I built for my recent project: https://github.com/djohnsonkc/code-samples/tree/master/React-Native/CalendarSync
This works for me @jodelat .
RNCalendarEvents.saveEvent(eventObject.name, {
...(eventObject.calendarEvent && eventObject.calendarEvent.calendarEventId ? { id: eventObject.calendarEvent.calendarEventId } : {}),
calendarId: res.data.getUser.profile.calendar,
startDate: new Date(eventObject.date).getTime(),
location: eventObject.placeName,
endDate: new Date(eventObject.date).getTime() + 1.5 * 60 * 60 * 1000
}).then(eventId => {
...
}).catch(err => console.log(err))
"react-native": "0.61.4" "react-native-calendar-events": "^1.7.3"
Does anyone here think that we should make a change to the lib?
@MoOx I believe that you're right
I am thinking about only allowing dates as time float.
I used to have a working
react-native-calendar-events
library at version1.6.1
, but since I upgraded to React Native 60.4 andreact-native-calendar-events
to version1.7.3
users cannot add events to calendar.On Android, they get an error message, on iOS it just crashes the app.
The error message on Android is coming from this asynchronous component helper function:
Environment
I went back to
react-native-calendar-events
1.6.1 and I am still getting the same issue.This library looks like it still uses
index.ios.js
andindex.android.js
even though React Native 60+ versions are now onindex.js
as root. Could this be the problem?Steps to Reproduce
Please clone: https://github.com/ldco2016/RNapp
What would be a cause of receiving
undetermined
as a Promise?