Possibility to add an alert for iOS
I added the possibility to set an alarm since there was none by default. It works for iOS, because in Android, it use the native calendar, and users already got reminder 5 or 10 minutes before any events on their calendar, but not on iOS if no alarm is set.
I just added a field alert, and manage the differences in ios/AddCalendarEvent.m and succeed to manage it thanks to EKAlarm.
You just have to pass a field alert in the eventConfig.
- 0 will set an alarm equal to startDate.
- 1 will set an alarm 5 minutes before startDate.
- 2 will set an alarm 30 minutes before startDate.
- 3 will set an alarm 60 minutes before startDate.
Fell free to tell me if there's anything I forgot, or if you meet any troubles !
Resolve conflicts and add functionality, please!
yes please resolve the conflicts and merge !
Just wanted to share what is working for me to add alerts to iOS. As suggested above I'm using alarmWithRelativeOffset. This allows me a way to pass in any alert in minutes to options.
if (options[_alert]) {
int offset = [RCTConvert int:options[_alert]];
NSTimeInterval alarmOffset = offset*-60;
EKAlarm * alarm = [EKAlarm alarmWithRelativeOffset:alarmOffset];
event.alarms = @[alarm];
}
@jordanwade would you be willing to open a PR? it'd be much appreciated, thanks!
Just wanted to share what is working for me to add alerts to iOS. As suggested above I'm using
alarmWithRelativeOffset. This allows me a way to pass in any alert in minutes to options.if (options[_alert]) { int offset = [RCTConvert int:options[_alert]]; NSTimeInterval alarmOffset = offset*-60; EKAlarm * alarm = [EKAlarm alarmWithRelativeOffset:alarmOffset]; event.alarms = @[alarm]; }
This works nicely on my testing as well, please open a PR :)
Also, would you mind implementing this to Android as well? Thanks!
Ah would love this feature! but wouldn't know where to start with adding the Android functionality, @MayeuldP @vonovak any ideas if or when Android might be added and this might get merged?
hello @Jbarget and thanks for commenting, as explained in the readme, I no longer actively develop the package. If you want to add new features, you can hire me, as explained https://github.com/vonovak/react-native-add-calendar-event#maintenance-notice
thank you
Resolve conflicts and add functionality, please!