feat: honor alarms, recurrence, allDay, availability, url & timeZone in saveEvent/updateEvent - #2
Open
kukat wants to merge 2 commits into
Open
Conversation
…in saveEvent/updateEvent saveEvent/updateEvent previously accepted only 6 flat scalar params (title, startDate, endDate, location, notes, calendarId), so alarms and every other rich field were silently dropped on iOS — even though the README documents alarm support and iOS already had a complete `applyEventProperties:` helper (it just wasn't called). Android's native saveEvent already took a ReadableMap, so its signature didn't even match the flat TurboModule spec. Change saveEvent/updateEvent to take a single `details` object (typed as `Object` in the spec -> NSDictionary / ReadableMap, matching how e.g. react-native-netinfo passes dictionaries and avoiding a codegen C++ struct that conflicts with the native impl): - spec: saveEvent(details), updateEvent(eventId, details) - iOS: route both through the existing applyEventProperties:, which handles alarms (absolute date + relative minutes), recurrence, availability, allDay, url. Guard every field so a partial updateEvent() no longer clobbers untouched properties or reassigns an existing event to the default calendar. Add timeZone for parity with Android. - Android: now matches the spec (was already ReadableMap-based); no logic change. - JS: forward the full CalendarEvent (Date -> ISO strings) instead of 6 fields. Public JS API (saveEvent(event: CalendarEvent)) is unchanged; the documented alarms/recurrence/availability/allDay/url fields now actually take effect.
The Android module was broken under the new architecture in three ways,
so getEnforcing('RNCalendarEventsNativeSpec') failed at runtime while iOS
worked:
- NAME was "CalendarEventsNative" but the JS spec and iOS
RCT_EXPORT_MODULE both use "RNCalendarEventsNativeSpec" -> module not
found. Align NAME (drives @ReactModule, getName(), and the
ReactModuleInfo/getModule registration).
- The module did not implement TurboModule, so
ReactPackageTurboModuleManagerDelegate.getModule() returned null
("Unable to create module ... turbo: true"). Add the marker interface.
- findOrCreateCalendar(ReadableMap) did not match the codegen signature
findOrCreateCalendar(String, String, String, String) the C++ layer
invokes reflectively, and debugModuleMethods was missing. Correct the
signature and add the method.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
saveEvent/updateEventpreviously accepted only 6 flat scalar params (title, startDate, endDate, location, notes, calendarId), so alarms and every other rich field were silently dropped on iOS — even though the README documents alarm support and iOS already had a completeapplyEventProperties:helper that simply wasn't being called. Android's nativesaveEventalready took aReadableMap, so its signature didn't even match the flat TurboModule spec.This changes
saveEvent/updateEventto take a singledetailsobject.Changes
saveEvent(details),updateEvent(eventId, details).detailsis typed asObjectso codegen maps it toNSDictionary/ReadableMap(a structured type would emit a C++ struct that conflicts with the native impl and can't express the union/optional-heavyCalendarEventshape — matching how e.g. react-native-netinfo passes dictionaries).applyEventProperties:, which handles alarms (absolute date + relative minutes), recurrence, availability, allDay, url. Every field is guarded so a partialupdateEvent()no longer clobbers untouched properties or reassigns an existing event to the default calendar. AddstimeZonefor parity with Android.ReadableMap-based); no logic change.CalendarEvent(Date → ISO strings) instead of 6 fields.Compatibility
Public JS API (
saveEvent(event: CalendarEvent)) is unchanged; the documented alarms/recurrence/availability/allDay/url fields now actually take effect.🤖 Generated with Claude Code