diff --git a/README.md b/README.md index 1975a2dc..95f8d23b 100644 --- a/README.md +++ b/README.md @@ -341,6 +341,7 @@ request is an object containing: - `isCritical` : If true, the notification sound be played even when the device is locked, muted, or has Do Not Disturb enabled. - `criticalSoundVolume` : A number between 0 and 1 for volume of critical notification. Default volume will be used if not specified. - `userInfo` : An object containing additional notification data. +- `isTimeZoneAgnostic` : If true, fireDate adjusted automatically upon time zone changes (e.g. for an alarm clock). request.repeatsComponent is an object containing (each field is optionnal): diff --git a/ios/RCTConvert+Notification.m b/ios/RCTConvert+Notification.m index b0b81f54..2bfc31a4 100644 --- a/ios/RCTConvert+Notification.m +++ b/ios/RCTConvert+Notification.m @@ -35,6 +35,7 @@ + (UILocalNotification *)UILocalNotification:(id)json { NSDictionary *details = [self NSDictionary:json]; BOOL isSilent = [RCTConvert BOOL:details[@"isSilent"]]; + BOOL isTimeZoneAgnostic = [RCTConvert BOOL:details[@"isTimeZoneAgnostic"]]; UILocalNotification *notification = [UILocalNotification new]; notification.alertTitle = [RCTConvert NSString:details[@"alertTitle"]]; notification.fireDate = [RCTConvert NSDate:details[@"fireDate"]] ?: [NSDate date]; @@ -49,6 +50,9 @@ + (UILocalNotification *)UILocalNotification:(id)json if (!isSilent) { notification.soundName = [RCTConvert NSString:details[@"soundName"]] ?: UILocalNotificationDefaultSoundName; } + if (isTimeZoneAgnostic) { + notification.timeZone = [NSTimeZone defaultTimeZone]; + } return notification; } diff --git a/js/types.js b/js/types.js index df3545d0..eea09a13 100644 --- a/js/types.js +++ b/js/types.js @@ -74,6 +74,10 @@ export type NotificationRequest = {| * Optional data to be added to the notification */ userInfo?: Object, + /** + * FireDate adjusted automatically upon time zone changes (e.g. for an alarm clock). + */ + isTimeZoneAgnostic?: boolean, |}; /**