wmcmahan / react-native-calendar-events

📆 React Native Module for iOS and Android Calendar Events
MIT License
906 stars 292 forks source link

Long Delay and Duplicate Events After Updating Existing Event #362

Closed PAronofsky closed 3 years ago

PAronofsky commented 3 years ago

When using saveEvent to update a single existing event on Android Tablets, the updated event is duplicated for a while: it's visible on its new date and time, and also still shows up under the old date and time for approximately 2 minutes or longer.

Also, slightly different but may be related, on the Android Pixel 2, the updated event is not showing twice, but is taking up to 2 minutes to reflect in the calendar.

Environment

Tablets: Android Samsung Galaxy Tab A (Android 10), and Nexus 9 (Android 7.1.1) Phone: Pixel 2 (Android 11)

System: OS: macOS 10.15.7 CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz Memory: 27.94 MB / 16.00 GB Shell: 5.7.1 - /bin/zsh Binaries: Node: 14.15.0 - ~/.nvm/versions/node/v14.15.0/bin/node npm: 6.14.8 - ~/.nvm/versions/node/v14.15.0/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2 Android SDK: API Levels: 28, 29, 30 Build Tools: 28.0.3, 29.0.2, 30.0.2 System Images: android-30 | Google APIs Intel x86 Atom IDEs: Android Studio: 4.1 AI-201.8743.12.41.6953283 Xcode: 12.4/12D4e - /usr/bin/xcodebuild npmPackages: react: 16.9.0 => 16.9.0 react-native: 0.61.5 => 0.61.5 npmGlobalPackages: react-native-cli: 2.0.1

Steps to Reproduce

await RNCalendarEvents.saveEvent( eventName, // "Module 1 Flashcards" (assignment due) { id: existingEventId, // "924" startDate: eventDate.toISOString(), // Fri May 07 2021 15:10:00 GMT-0400 (Eastern Daylight Time) endDate: eventDate.toISOString(), // Note: we use this as a due date/time, so start and end times are equal calendarId: primaryCalendarId, // "1" notes: eventNote, // "some text" description: eventDetails // "some text" } );

Expected Behavior

Expected the event datetime to reflect in the calendar immediately, and for the updated event to no longer appear on its previous datetime.

Actual Behavior

On Tablets, the event is showing twice for 2 minutes or longer, one on the updated datetime, another on the previous datetime. (New circled in blue, old circled in red)

image

wmcmahan commented 3 years ago

This seems like maybe it's an issue with calendar syncing. Try checking your device's calendar settings, and ensure that syncing is enabled.

There is also a third argument, which might be helpful, that allows for syncing on save (Android only). But normally, enabling within the devices calendar settings helps best.

RNCalendarEvents.saveEvent(<name>, <settings>, { sync: true })
PAronofsky commented 3 years ago

Thanks, @wmcmahan it did look like a syncing issue, I appreciate the input! The colors are very similar on this device and it looks like one was on the device calendar, the other was synced with google calendar on a separate device.

MoOx commented 3 years ago

This was undocumented. I added more info in the readme about this in 69ec2a5c055244f16ceb467edb0a76471face239

PAronofsky commented 3 years ago

Thanks, although adding the extra option did not work for me (and doesn't look like it's available on the Options type).

MoOx commented 3 years ago

Are you using typescript? The option seems to exist in both js & java code: https://github.com/wmcmahan/react-native-calendar-events/search?q=sync

PAronofsky commented 3 years ago

Yeah, I meant in typescript, I put in a small PR above