react-native-calendar-events
react-native-calendar-events copied to clipboard
Bug: Alarm offset must be positive on Android, but negative on iOS
When creating a calendar event with alarms
the number of minutes must be different between iOS and Android or otherwise on one platform the alarm is before the startDate
and on the other it's after the startDate
.
iOS | Android |
---|---|
![]() |
![]() |
Also, the number is not allowed to be negative on Android or it might not show the alarms at all.
Environment
System:
OS: macOS 10.15.7
CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
Memory: 350.89 MB / 16.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 12.14.1 - /var/folders/hp/wl2yw33n69xf_1lkp8y6gry80000gn/T/yarn--1605546136287-0.33153789553280055/node
Yarn: 1.22.5 - /var/folders/hp/wl2yw33n69xf_1lkp8y6gry80000gn/T/yarn--1605546136287-0.33153789553280055/yarn
npm: 6.13.4 - /usr/local/Cellar/nvm/0.33.11/versions/node/v12.14.1/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.7, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
Android SDK: Not Found
IDEs:
Android Studio: 3.5 AI-191.8026.42.35.5900203
Xcode: 11.7/11E801a - /usr/bin/xcodebuild
Languages:
Java: 11.0.7 - /usr/bin/javac
Python: 3.6.4 - /Users/oliver/.pyenv/shims/python
npmPackages:
@react-native-community/cli: Not Found
react: 16.11.0 => 16.11.0
react-native: 0.62.2 => 0.62.2
npmGlobalPackages:
*react-native*: Not Found
Steps to Reproduce
Sorry, this is an incomplete code sample.
RNCalendarEvents.saveEvent(title, {
calendarId,
description,
notes: description,
startDate: startDate.toISOString(),
endDate: endDate.toISOString(),
alarms: [{
date: 30
}],
});
Expected Behavior
I expect to get the same behavior on both, Android and iOS, when using the same data.
Actual Behavior
I get different results between Android and iOS.
Notes
I suggest to add Math.abs()
to the Android code as CalendarContract.Reminders.MINUTES
isn't allowed to be a negative value anyway (with the exception of -1
).
https://github.com/wmcmahan/react-native-calendar-events/blob/1bb027b02ea8bb9ba1fb18f7b65eb25be9677890/android/src/main/java/com/calendarevents/RNCalendarEvents.java#L877
Same problem here...
Some people said that they were successfully using negative number.
Anyway, PR is welcome to improve the lib. This will be released as a major release even if that's a minor change because some people so iOS ? 30 : -30.
Same thing happening here.