react-native-macos 0.73.4 → 0.73.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,6 +12,6 @@
12
12
  exports.version = {
13
13
  major: 0,
14
14
  minor: 73,
15
- patch: 4,
15
+ patch: 6,
16
16
  prerelease: null,
17
17
  };
@@ -20,17 +20,45 @@ type Permissions = {|
20
20
 
21
21
  type Notification = {|
22
22
  +alertTitle?: ?string,
23
- // Actual type: string | number
24
- +fireDate?: ?number,
25
23
  +alertBody?: ?string,
26
- +alertAction?: ?string,
27
24
  +userInfo?: ?Object,
25
+ /**
26
+ * Identifier for the notification category. See the [Apple documentation](https://developer.apple.com/documentation/usernotifications/declaring_your_actionable_notification_types)
27
+ * for more details.
28
+ */
28
29
  +category?: ?string,
29
- // Actual type: 'year' | 'month' | 'week' | 'day' | 'hour' | 'minute'
30
- +repeatInterval?: ?string,
30
+ /**
31
+ * Actual type: string | number
32
+ *
33
+ * Schedule notifications using EITHER `fireDate` or `fireIntervalSeconds`.
34
+ * If both are specified, `fireDate` takes precedence.
35
+ * If you use `presentLocalNotification`, both will be ignored
36
+ * and the notification will be shown immediately.
37
+ */
38
+ +fireDate?: ?number,
39
+ /**
40
+ * Seconds from now to display the notification.
41
+ *
42
+ * Schedule notifications using EITHER `fireDate` or `fireIntervalSeconds`.
43
+ * If both are specified, `fireDate` takes precedence.
44
+ * If you use `presentLocalNotification`, both will be ignored
45
+ * and the notification will be shown immediately.
46
+ */
47
+ +fireIntervalSeconds?: ?number,
48
+ /** Badge count to display on the app icon. */
31
49
  +applicationIconBadgeNumber?: ?number,
50
+ /** Whether to silence the notification sound. */
32
51
  +isSilent?: ?boolean,
52
+ /**
53
+ * Custom notification sound to play. Write-only: soundName will be null when
54
+ * accessing already created notifications using getScheduledLocalNotifications
55
+ * or getDeliveredNotifications.
56
+ */
33
57
  +soundName?: ?string,
58
+ /** DEPRECATED. This was used for iOS's legacy UILocalNotification. */
59
+ +alertAction?: ?string,
60
+ /** DEPRECATED. Use `fireDate` or `fireIntervalSeconds` instead. */
61
+ +repeatInterval?: ?string,
34
62
  |};
35
63
 
36
64
  export interface Spec extends TurboModule {
@@ -16,9 +16,6 @@ typedef void (^RCTRemoteNotificationCallback)(UIBackgroundFetchResult result);
16
16
  #endif // [macOS]
17
17
 
18
18
  #if !TARGET_OS_UIKITFORMAC
19
- #if !TARGET_OS_OSX // [macOS]
20
- + (void)didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings;
21
- #endif // [macOS]
22
19
  + (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken;
23
20
  + (void)didReceiveRemoteNotification:(NSDictionary *)notification;
24
21
  #if !TARGET_OS_OSX // [macOS]
@@ -25,88 +25,66 @@ static NSString *const kRemoteNotificationRegistrationFailed = @"RemoteNotificat
25
25
  static NSString *const kErrorUnableToRequestPermissions = @"E_UNABLE_TO_REQUEST_PERMISSIONS";
26
26
 
27
27
  #if !TARGET_OS_UIKITFORMAC
28
- @implementation RCTConvert (NSCalendarUnit)
29
-
30
- RCT_ENUM_CONVERTER(
31
- NSCalendarUnit,
32
- (@{
33
- @"year" : @(NSCalendarUnitYear),
34
- @"month" : @(NSCalendarUnitMonth),
35
- @"week" : @(NSCalendarUnitWeekOfYear),
36
- @"day" : @(NSCalendarUnitDay),
37
- @"hour" : @(NSCalendarUnitHour),
38
- @"minute" : @(NSCalendarUnitMinute)
39
- }),
40
- 0,
41
- integerValue)
42
-
43
- @end
44
28
 
45
29
  @interface RCTPushNotificationManager () <NativePushNotificationManagerIOSSpec>
46
30
  @property (nonatomic, strong) NSMutableDictionary *remoteNotificationCallbacks;
47
31
  @end
48
32
 
49
- @implementation RCTConvert (UILocalNotification)
33
+ @implementation RCTConvert (UNNotificationContent)
50
34
 
51
- #if !TARGET_OS_OSX // [macOS]
52
- + (UILocalNotification *)UILocalNotification:(id)json
35
+ + (UNNotificationContent *)UNNotificationContent:(id)json
53
36
  {
54
37
  NSDictionary<NSString *, id> *details = [self NSDictionary:json];
55
38
  BOOL isSilent = [RCTConvert BOOL:details[@"isSilent"]];
56
- UILocalNotification *notification = [UILocalNotification new];
57
- notification.alertTitle = [RCTConvert NSString:details[@"alertTitle"]];
58
- notification.fireDate = [RCTConvert NSDate:details[@"fireDate"]] ?: [NSDate date];
59
- notification.alertBody = [RCTConvert NSString:details[@"alertBody"]];
60
- notification.alertAction = [RCTConvert NSString:details[@"alertAction"]];
61
- notification.userInfo = [RCTConvert NSDictionary:details[@"userInfo"]];
62
- notification.category = [RCTConvert NSString:details[@"category"]];
63
- notification.repeatInterval = [RCTConvert NSCalendarUnit:details[@"repeatInterval"]];
39
+ UNMutableNotificationContent *content = [UNMutableNotificationContent new];
40
+ content.title = [RCTConvert NSString:details[@"alertTitle"]];
41
+ content.body = [RCTConvert NSString:details[@"alertBody"]];
42
+ content.userInfo = [RCTConvert NSDictionary:details[@"userInfo"]];
43
+ content.categoryIdentifier = [RCTConvert NSString:details[@"category"]];
64
44
  if (details[@"applicationIconBadgeNumber"]) {
65
- notification.applicationIconBadgeNumber = [RCTConvert NSInteger:details[@"applicationIconBadgeNumber"]];
45
+ content.badge = [RCTConvert NSNumber:details[@"applicationIconBadgeNumber"]];
66
46
  }
67
47
  if (!isSilent) {
68
- notification.soundName = [RCTConvert NSString:details[@"soundName"]] ?: UILocalNotificationDefaultSoundName;
48
+ NSString *soundName = [RCTConvert NSString:details[@"soundName"]];
49
+ content.sound =
50
+ soundName ? [UNNotificationSound soundNamed:details[@"soundName"]] : [UNNotificationSound defaultSound];
69
51
  }
70
- return notification;
52
+
53
+ return content;
71
54
  }
72
- #else // [macOS
73
- + (NSUserNotification *)NSUserNotification:(id)json
55
+
56
+ + (NSDictionary<NSString *, id> *)NSDictionaryForNotification:
57
+ (JS::NativePushNotificationManagerIOS::Notification &)notification
74
58
  {
75
- NSDictionary<NSString *, id> *details = [self NSDictionary:json];
76
- BOOL isSilent = [RCTConvert BOOL:details[@"isSilent"]];
77
- NSUserNotification *notification = [NSUserNotification new];
78
- notification.deliveryDate = [RCTConvert NSDate:details[@"fireDate"]] ?: [NSDate date];
79
- notification.informativeText = [RCTConvert NSString:details[@"alertBody"]];
80
- NSString *title = [RCTConvert NSString:details[@"alertTitle"]];
81
- if (title) {
82
- notification.title = title;
83
- }
84
- NSString *actionButtonTitle = [RCTConvert NSString:details[@"alertAction"]];
85
- if (actionButtonTitle) {
86
- notification.actionButtonTitle = actionButtonTitle;
59
+ // Note: alertAction is not set, as it is no longer relevant with UNNotification
60
+ NSMutableDictionary *notificationDict = [NSMutableDictionary new];
61
+ notificationDict[@"alertTitle"] = notification.alertTitle();
62
+ notificationDict[@"alertBody"] = notification.alertBody();
63
+ notificationDict[@"userInfo"] = notification.userInfo();
64
+ notificationDict[@"category"] = notification.category();
65
+ if (notification.fireIntervalSeconds()) {
66
+ notificationDict[@"fireIntervalSeconds"] = @(*notification.fireIntervalSeconds());
87
67
  }
88
- notification.userInfo = [RCTConvert NSDictionary:details[@"userInfo"]];
89
-
90
- NSCalendarUnit calendarUnit = [RCTConvert NSCalendarUnit:details[@"repeatInterval"]];
91
- if (calendarUnit > 0) {
92
- NSDateComponents *dateComponents = [NSDateComponents new];
93
- [dateComponents setValue:1 forComponent:calendarUnit];
94
- notification.deliveryRepeatInterval = dateComponents;
68
+ if (notification.fireDate()) {
69
+ notificationDict[@"fireDate"] = @(*notification.fireDate());
95
70
  }
96
- if (!isSilent) {
97
- notification.soundName = [RCTConvert NSString:details[@"soundName"]] ?: NSUserNotificationDefaultSoundName;
71
+ if (notification.applicationIconBadgeNumber()) {
72
+ notificationDict[@"applicationIconBadgeNumber"] = @(*notification.applicationIconBadgeNumber());
98
73
  }
99
-
100
- NSString *identifier = [RCTConvert NSString:details[@"identifier"]];
101
- if (identifier == nil) {
102
- identifier = [[NSUUID UUID] UUIDString];
74
+ if (notification.isSilent()) {
75
+ notificationDict[@"isSilent"] = @(*notification.isSilent());
76
+ if ([notificationDict[@"isSilent"] isEqualToNumber:@(NO)]) {
77
+ notificationDict[@"soundName"] = notification.soundName();
78
+ }
103
79
  }
104
- notification.identifier = identifier;
105
- return notification;
80
+ return notificationDict;
106
81
  }
107
- #endif // macOS]
82
+
83
+ @end
108
84
 
109
85
  #if !TARGET_OS_OSX // [macOS]
86
+ @implementation RCTConvert (UIBackgroundFetchResult)
87
+
110
88
  RCT_ENUM_CONVERTER(
111
89
  UIBackgroundFetchResult,
112
90
  (@{
@@ -116,9 +94,9 @@ RCT_ENUM_CONVERTER(
116
94
  }),
117
95
  UIBackgroundFetchResultNoData,
118
96
  integerValue)
119
- #endif // [macOS]
120
97
 
121
98
  @end
99
+ #endif // [macOS]
122
100
  #else
123
101
  @interface RCTPushNotificationManager () <NativePushNotificationManagerIOSSpec>
124
102
  @end
@@ -126,8 +104,10 @@ RCT_ENUM_CONVERTER(
126
104
 
127
105
  @implementation RCTPushNotificationManager
128
106
 
129
- #if !TARGET_OS_UIKITFORMAC && !TARGET_OS_OSX // [macOS]
107
+ #if !TARGET_OS_UIKITFORMAC
130
108
 
109
+ #if !TARGET_OS_OSX // [macOS]
110
+ /** DEPRECATED. UILocalNotification was deprecated in iOS 10. Please don't add new callsites. */
131
111
  static NSDictionary *RCTFormatLocalNotification(UILocalNotification *notification)
132
112
  {
133
113
  NSMutableDictionary *formattedLocalNotification = [NSMutableDictionary dictionary];
@@ -146,33 +126,7 @@ static NSDictionary *RCTFormatLocalNotification(UILocalNotification *notificatio
146
126
  formattedLocalNotification[@"remote"] = @NO;
147
127
  return formattedLocalNotification;
148
128
  }
149
-
150
- static NSDictionary *RCTFormatUNNotification(UNNotification *notification)
151
- {
152
- NSMutableDictionary *formattedNotification = [NSMutableDictionary dictionary];
153
- UNNotificationContent *content = notification.request.content;
154
-
155
- formattedNotification[@"identifier"] = notification.request.identifier;
156
-
157
- if (notification.date) {
158
- NSDateFormatter *formatter = [NSDateFormatter new];
159
- [formatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ"];
160
- NSString *dateString = [formatter stringFromDate:notification.date];
161
- formattedNotification[@"date"] = dateString;
162
- }
163
-
164
- formattedNotification[@"title"] = RCTNullIfNil(content.title);
165
- formattedNotification[@"body"] = RCTNullIfNil(content.body);
166
- formattedNotification[@"category"] = RCTNullIfNil(content.categoryIdentifier);
167
- formattedNotification[@"thread-id"] = RCTNullIfNil(content.threadIdentifier);
168
- formattedNotification[@"userInfo"] = RCTNullIfNil(RCTJSONClean(content.userInfo));
169
-
170
- return formattedNotification;
171
- }
172
-
173
- #endif // TARGET_OS_UIKITFORMAC
174
- #if TARGET_OS_OSX // [macOS
175
-
129
+ #else // [macOS
176
130
  static NSDictionary *RCTFormatUserNotification(NSUserNotification *notification)
177
131
  {
178
132
  NSMutableDictionary *formattedUserNotification = [NSMutableDictionary dictionary];
@@ -192,6 +146,60 @@ static NSDictionary *RCTFormatUserNotification(NSUserNotification *notification)
192
146
  }
193
147
  #endif // macOS]
194
148
 
149
+ /** For delivered notifications */
150
+ static NSDictionary<NSString *, id> *RCTFormatUNNotification(UNNotification *notification)
151
+ {
152
+ NSMutableDictionary *formattedLocalNotification = [NSMutableDictionary dictionary];
153
+ if (notification.date) {
154
+ formattedLocalNotification[@"fireDate"] = RCTFormatNotificationDateFromNSDate(notification.date);
155
+ }
156
+ [formattedLocalNotification addEntriesFromDictionary:RCTFormatUNNotificationContent(notification.request.content)];
157
+ return formattedLocalNotification;
158
+ }
159
+
160
+ /** For scheduled notification requests */
161
+ static NSDictionary<NSString *, id> *RCTFormatUNNotificationRequest(UNNotificationRequest *request)
162
+ {
163
+ NSMutableDictionary *formattedLocalNotification = [NSMutableDictionary dictionary];
164
+ if (request.trigger) {
165
+ NSDate *triggerDate = nil;
166
+ if ([request.trigger isKindOfClass:[UNTimeIntervalNotificationTrigger class]]) {
167
+ triggerDate = [(UNTimeIntervalNotificationTrigger *)request.trigger nextTriggerDate];
168
+ } else if ([request.trigger isKindOfClass:[UNCalendarNotificationTrigger class]]) {
169
+ triggerDate = [(UNCalendarNotificationTrigger *)request.trigger nextTriggerDate];
170
+ }
171
+
172
+ if (triggerDate) {
173
+ formattedLocalNotification[@"fireDate"] = RCTFormatNotificationDateFromNSDate(triggerDate);
174
+ }
175
+ }
176
+ [formattedLocalNotification addEntriesFromDictionary:RCTFormatUNNotificationContent(request.content)];
177
+ return formattedLocalNotification;
178
+ }
179
+
180
+ static NSDictionary<NSString *, id> *RCTFormatUNNotificationContent(UNNotificationContent *content)
181
+ {
182
+ // Note: soundName is not set because this can't be read from UNNotificationSound.
183
+ // Note: alertAction is no longer relevant with UNNotification
184
+ NSMutableDictionary *formattedLocalNotification = [NSMutableDictionary dictionary];
185
+ formattedLocalNotification[@"alertTitle"] = RCTNullIfNil(content.title);
186
+ formattedLocalNotification[@"alertBody"] = RCTNullIfNil(content.body);
187
+ formattedLocalNotification[@"userInfo"] = RCTNullIfNil(RCTJSONClean(content.userInfo));
188
+ formattedLocalNotification[@"category"] = content.categoryIdentifier;
189
+ formattedLocalNotification[@"applicationIconBadgeNumber"] = content.badge;
190
+ formattedLocalNotification[@"remote"] = @NO;
191
+ return formattedLocalNotification;
192
+ }
193
+
194
+ static NSString *RCTFormatNotificationDateFromNSDate(NSDate *date)
195
+ {
196
+ NSDateFormatter *formatter = [NSDateFormatter new];
197
+ [formatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ"];
198
+ return [formatter stringFromDate:date];
199
+ }
200
+
201
+ #endif // TARGET_OS_UIKITFORMAC
202
+
195
203
  RCT_EXPORT_MODULE()
196
204
 
197
205
  - (dispatch_queue_t)methodQueue
@@ -235,12 +243,6 @@ RCT_EXPORT_MODULE()
235
243
  ];
236
244
  }
237
245
 
238
- #if !TARGET_OS_OSX // [macOS]
239
- + (void)didRegisterUserNotificationSettings:(__unused UIUserNotificationSettings *)notificationSettings
240
- {
241
- }
242
- #endif // [macOS]
243
-
244
246
  + (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
245
247
  {
246
248
  NSMutableString *hexString = [NSMutableString string];
@@ -278,16 +280,16 @@ RCT_EXPORT_MODULE()
278
280
  object:self
279
281
  userInfo:userInfo];
280
282
  }
283
+ #endif // [macOS]
281
284
 
285
+ #if !TARGET_OS_OSX // [macOS]
282
286
  + (void)didReceiveLocalNotification:(UILocalNotification *)notification
283
287
  {
284
288
  [[NSNotificationCenter defaultCenter] postNotificationName:kLocalNotificationReceived
285
289
  object:self
286
290
  userInfo:RCTFormatLocalNotification(notification)];
287
291
  }
288
-
289
- #else // [macOS
290
-
292
+ #else // [macOS
291
293
  + (void)didReceiveUserNotification:(NSUserNotification *)notification
292
294
  {
293
295
  NSString *notificationName = notification.isRemote ? RCTRemoteNotificationReceived : kLocalNotificationReceived;
@@ -296,7 +298,6 @@ RCT_EXPORT_MODULE()
296
298
  object:self
297
299
  userInfo:userInfo];
298
300
  }
299
-
300
301
  #endif // macOS]
301
302
 
302
303
  - (void)handleLocalNotificationReceived:(NSNotification *)notification
@@ -306,15 +307,13 @@ RCT_EXPORT_MODULE()
306
307
 
307
308
  - (void)handleRemoteNotificationReceived:(NSNotification *)notification
308
309
  {
310
+ #if !TARGET_OS_OSX // [macOS]
309
311
  NSMutableDictionary *remoteNotification =
310
312
  [NSMutableDictionary dictionaryWithDictionary:notification.userInfo[@"notification"]];
311
- #if !TARGET_OS_OSX // [macOS]
312
313
  RCTRemoteNotificationCallback completionHandler = notification.userInfo[@"completionHandler"];
313
- #endif // [macOS]
314
314
  NSString *notificationId = [[NSUUID UUID] UUIDString];
315
315
  remoteNotification[@"notificationId"] = notificationId;
316
316
  remoteNotification[@"remote"] = @YES;
317
- #if !TARGET_OS_OSX // [macOS]
318
317
  if (completionHandler) {
319
318
  if (!self.remoteNotificationCallbacks) {
320
319
  // Lazy initialization
@@ -322,9 +321,9 @@ RCT_EXPORT_MODULE()
322
321
  }
323
322
  self.remoteNotificationCallbacks[notificationId] = completionHandler;
324
323
  }
325
- #endif // [macOS]
326
324
 
327
325
  [self sendEventWithName:@"remoteNotificationReceived" body:remoteNotification];
326
+ #endif // [macOS]
328
327
  }
329
328
 
330
329
  - (void)handleRemoteNotificationsRegistered:(NSNotification *)notification
@@ -343,9 +342,9 @@ RCT_EXPORT_MODULE()
343
342
  [self sendEventWithName:@"remoteNotificationRegistrationError" body:errorDetails];
344
343
  }
345
344
 
346
- #if !TARGET_OS_OSX // [macOS]
347
345
  RCT_EXPORT_METHOD(onFinishRemoteNotification : (NSString *)notificationId fetchResult : (NSString *)fetchResult)
348
346
  {
347
+ #if !TARGET_OS_OSX // [macOS]
349
348
  UIBackgroundFetchResult result = [RCTConvert UIBackgroundFetchResult:fetchResult];
350
349
  RCTRemoteNotificationCallback completionHandler = self.remoteNotificationCallbacks[notificationId];
351
350
  if (!completionHandler) {
@@ -354,8 +353,8 @@ RCT_EXPORT_METHOD(onFinishRemoteNotification : (NSString *)notificationId fetchR
354
353
  }
355
354
  completionHandler(result);
356
355
  [self.remoteNotificationCallbacks removeObjectForKey:notificationId];
357
- }
358
356
  #endif // [macOS]
357
+ }
359
358
 
360
359
  /**
361
360
  * Update the application icon badge number on the home screen
@@ -401,33 +400,19 @@ RCT_EXPORT_METHOD(requestPermissions
401
400
  // Add a listener to make sure that startObserving has been called
402
401
  [self addListener:@"remoteNotificationsRegistered"];
403
402
 
404
- #if !TARGET_OS_OSX // [macOS
405
- UIUserNotificationType types = UIUserNotificationTypeNone;
403
+ UNAuthorizationOptions options = UNAuthorizationOptionNone;
406
404
 
407
405
  if (permissions.alert()) {
408
- types |= UIUserNotificationTypeAlert;
406
+ options |= UNAuthorizationOptionAlert;
409
407
  }
410
408
  if (permissions.badge()) {
411
- types |= UIUserNotificationTypeBadge;
409
+ options |= UNAuthorizationOptionBadge;
412
410
  }
413
411
  if (permissions.sound()) {
414
- types |= UIUserNotificationTypeSound;
412
+ options |= UNAuthorizationOptionSound;
415
413
  }
416
- #else
417
- NSRemoteNotificationType types = NSRemoteNotificationTypeNone;
418
-
419
- if (permissions.alert()) {
420
- types |= NSRemoteNotificationTypeAlert;
421
- }
422
- if (permissions.badge()) {
423
- types |= NSRemoteNotificationTypeBadge;
424
- }
425
- if (permissions.sound()) {
426
- types |= NSRemoteNotificationTypeSound;
427
- }
428
- #endif // macOS]
429
414
  [UNUserNotificationCenter.currentNotificationCenter
430
- requestAuthorizationWithOptions:types
415
+ requestAuthorizationWithOptions:options
431
416
  completionHandler:^(BOOL granted, NSError *_Nullable error) {
432
417
  if (error != NULL) {
433
418
  reject(@"-1", @"Error - Push authorization request failed.", error);
@@ -496,108 +481,87 @@ static inline NSDictionary *RCTSettingsDictForUNNotificationSettings(
496
481
  };
497
482
  }
498
483
 
499
- #if !TARGET_OS_OSX // [macOS]
500
484
  RCT_EXPORT_METHOD(presentLocalNotification : (JS::NativePushNotificationManagerIOS::Notification &)notification)
501
485
  {
502
- NSMutableDictionary *notificationDict = [NSMutableDictionary new];
503
- notificationDict[@"alertTitle"] = notification.alertTitle();
504
- notificationDict[@"alertBody"] = notification.alertBody();
505
- notificationDict[@"alertAction"] = notification.alertAction();
506
- notificationDict[@"userInfo"] = notification.userInfo();
507
- notificationDict[@"category"] = notification.category();
508
- notificationDict[@"repeatInterval"] = notification.repeatInterval();
509
- if (notification.fireDate()) {
510
- notificationDict[@"fireDate"] = @(*notification.fireDate());
511
- }
512
- if (notification.applicationIconBadgeNumber()) {
513
- notificationDict[@"applicationIconBadgeNumber"] = @(*notification.applicationIconBadgeNumber());
514
- }
515
- if (notification.isSilent()) {
516
- notificationDict[@"isSilent"] = @(*notification.isSilent());
517
- if ([notificationDict[@"isSilent"] isEqualToNumber:@(NO)]) {
518
- notificationDict[@"soundName"] = notification.soundName();
519
- }
520
- }
521
- [RCTSharedApplication() presentLocalNotificationNow:[RCTConvert UILocalNotification:notificationDict]];
522
- }
523
- #else // [macOS
524
- RCT_EXPORT_METHOD(presentLocalNotification:(NSUserNotification *)notification)
525
- {
526
- [[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:notification];
486
+ NSDictionary<NSString *, id> *notificationDict = [RCTConvert NSDictionaryForNotification:notification];
487
+ UNNotificationContent *content = [RCTConvert UNNotificationContent:notificationDict];
488
+ UNTimeIntervalNotificationTrigger *trigger = [UNTimeIntervalNotificationTrigger triggerWithTimeInterval:0.1
489
+ repeats:NO];
490
+ UNNotificationRequest *request = [UNNotificationRequest requestWithIdentifier:[[NSUUID UUID] UUIDString]
491
+ content:content
492
+ trigger:trigger];
493
+
494
+ UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
495
+ [center addNotificationRequest:request withCompletionHandler:nil];
527
496
  }
528
- #endif // macOS]
529
497
 
530
- #if !TARGET_OS_OSX // [macOS]
531
498
  RCT_EXPORT_METHOD(scheduleLocalNotification : (JS::NativePushNotificationManagerIOS::Notification &)notification)
532
499
  {
533
- NSMutableDictionary *notificationDict = [NSMutableDictionary new];
534
- notificationDict[@"alertTitle"] = notification.alertTitle();
535
- notificationDict[@"alertBody"] = notification.alertBody();
536
- notificationDict[@"alertAction"] = notification.alertAction();
537
- notificationDict[@"userInfo"] = notification.userInfo();
538
- notificationDict[@"category"] = notification.category();
539
- notificationDict[@"repeatInterval"] = notification.repeatInterval();
540
- if (notification.fireDate()) {
541
- notificationDict[@"fireDate"] = @(*notification.fireDate());
542
- }
543
- if (notification.applicationIconBadgeNumber()) {
544
- notificationDict[@"applicationIconBadgeNumber"] = @(*notification.applicationIconBadgeNumber());
545
- }
546
- if (notification.isSilent()) {
547
- notificationDict[@"isSilent"] = @(*notification.isSilent());
548
- if ([notificationDict[@"isSilent"] isEqualToNumber:@(NO)]) {
549
- notificationDict[@"soundName"] = notification.soundName();
550
- }
500
+ NSDictionary<NSString *, id> *notificationDict = [RCTConvert NSDictionaryForNotification:notification];
501
+ UNNotificationContent *content = [RCTConvert UNNotificationContent:notificationDict];
502
+
503
+ UNNotificationTrigger *trigger = nil;
504
+ if (notificationDict[@"fireDate"]) {
505
+ NSDate *fireDate = [RCTConvert NSDate:notificationDict[@"fireDate"]] ?: [NSDate date];
506
+ NSCalendar *calendar = [NSCalendar currentCalendar];
507
+ NSDateComponents *components =
508
+ [calendar components:(NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitHour |
509
+ NSCalendarUnitMinute | NSCalendarUnitSecond)
510
+ fromDate:fireDate];
511
+ trigger = [UNCalendarNotificationTrigger triggerWithDateMatchingComponents:components repeats:NO];
512
+ } else if (notificationDict[@"fireIntervalSeconds"]) {
513
+ trigger = [UNTimeIntervalNotificationTrigger
514
+ triggerWithTimeInterval:[notificationDict[@"fireIntervalSeconds"] doubleValue]
515
+ repeats:NO];
551
516
  }
552
- [RCTSharedApplication() scheduleLocalNotification:[RCTConvert UILocalNotification:notificationDict]];
553
- }
554
- #else // [macOS
555
- RCT_EXPORT_METHOD(scheduleLocalNotification:(NSUserNotification *)notification)
556
- {
557
- [[NSUserNotificationCenter defaultUserNotificationCenter] scheduleNotification:notification];
517
+
518
+ UNNotificationRequest *request = [UNNotificationRequest requestWithIdentifier:[[NSUUID UUID] UUIDString]
519
+ content:content
520
+ trigger:trigger];
521
+
522
+ UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
523
+ [center addNotificationRequest:request withCompletionHandler:nil];
558
524
  }
559
- #endif // macOS]
560
525
 
561
526
  RCT_EXPORT_METHOD(cancelAllLocalNotifications)
562
527
  {
563
- #if !TARGET_OS_OSX // [macOS]
564
- [RCTSharedApplication() cancelAllLocalNotifications];
565
- #else // [macOS
566
- for (NSUserNotification *notif in [NSUserNotificationCenter defaultUserNotificationCenter].scheduledNotifications) {
567
- [[NSUserNotificationCenter defaultUserNotificationCenter] removeScheduledNotification:notif];
568
- }
569
- #endif // macOS]
528
+ [[UNUserNotificationCenter currentNotificationCenter]
529
+ getPendingNotificationRequestsWithCompletionHandler:^(NSArray<UNNotificationRequest *> *requests) {
530
+ NSMutableArray<NSString *> *notificationIdentifiersToCancel = [NSMutableArray new];
531
+ for (UNNotificationRequest *request in requests) {
532
+ [notificationIdentifiersToCancel addObject:request.identifier];
533
+ }
534
+ [[UNUserNotificationCenter currentNotificationCenter]
535
+ removePendingNotificationRequestsWithIdentifiers:notificationIdentifiersToCancel];
536
+ }];
570
537
  }
571
538
 
572
539
  RCT_EXPORT_METHOD(cancelLocalNotifications : (NSDictionary<NSString *, id> *)userInfo)
573
540
  {
574
- #if !TARGET_OS_OSX // [macOS]
575
- for (UILocalNotification *notification in RCTSharedApplication().scheduledLocalNotifications) {
576
- #else // [macOS
577
- for (NSUserNotification *notification in [NSUserNotificationCenter defaultUserNotificationCenter].scheduledNotifications) {
578
- #endif // macOS]
579
- __block BOOL matchesAll = YES;
580
- NSDictionary<NSString *, id> *notificationInfo = notification.userInfo;
581
- // Note: we do this with a loop instead of just `isEqualToDictionary:`
582
- // because we only require that all specified userInfo values match the
583
- // notificationInfo values - notificationInfo may contain additional values
584
- // which we don't care about.
585
- [userInfo enumerateKeysAndObjectsUsingBlock:^(NSString *key, id obj, BOOL *stop) {
586
- if (![notificationInfo[key] isEqual:obj]) {
587
- matchesAll = NO;
588
- *stop = YES;
541
+ UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
542
+ [center getPendingNotificationRequestsWithCompletionHandler:^(NSArray<UNNotificationRequest *> *_Nonnull requests) {
543
+ NSMutableArray<NSString *> *notificationIdentifiersToCancel = [NSMutableArray new];
544
+ for (UNNotificationRequest *request in requests) {
545
+ NSDictionary<NSString *, id> *notificationInfo = request.content.userInfo;
546
+ // Note: we do this with a loop instead of just `isEqualToDictionary:`
547
+ // because we only require that all specified userInfo values match the
548
+ // notificationInfo values - notificationInfo may contain additional values
549
+ // which we don't care about.
550
+ __block BOOL shouldCancel = YES;
551
+ [userInfo enumerateKeysAndObjectsUsingBlock:^(NSString *key, id obj, BOOL *stop) {
552
+ if (![notificationInfo[key] isEqual:obj]) {
553
+ shouldCancel = NO;
554
+ *stop = YES;
555
+ }
556
+ }];
557
+
558
+ if (shouldCancel) {
559
+ [notificationIdentifiersToCancel addObject:request.identifier];
589
560
  }
590
- }];
591
- #if !TARGET_OS_OSX // [macOS]
592
- if (matchesAll) {
593
- [RCTSharedApplication() cancelLocalNotification:notification];
594
- }
595
- #else // [macOS
596
- if ([notification.identifier isEqualToString:userInfo[@"identifier"]] || matchesAll) {
597
- [[NSUserNotificationCenter defaultUserNotificationCenter] removeScheduledNotification:notification];
598
561
  }
599
- #endif // macOS]
600
- }
562
+
563
+ [center removePendingNotificationRequestsWithIdentifiers:notificationIdentifiersToCancel];
564
+ }];
601
565
  }
602
566
 
603
567
  RCT_EXPORT_METHOD(getInitialNotification
@@ -631,50 +595,30 @@ RCT_EXPORT_METHOD(getInitialNotification
631
595
 
632
596
  RCT_EXPORT_METHOD(getScheduledLocalNotifications : (RCTResponseSenderBlock)callback)
633
597
  {
634
- #if !TARGET_OS_OSX // [macOS]
635
- NSArray<UILocalNotification *> *scheduledLocalNotifications = RCTSharedApplication().scheduledLocalNotifications;
636
- #endif // [macOS]
637
- NSMutableArray<NSDictionary *> *formattedScheduledLocalNotifications = [NSMutableArray new];
638
- #if !TARGET_OS_OSX // [macOS]
639
- for (UILocalNotification *notification in scheduledLocalNotifications) {
640
- [formattedScheduledLocalNotifications addObject:RCTFormatLocalNotification(notification)];
641
- }
642
- #else // [macOS
643
- for (NSUserNotification *notification in [NSUserNotificationCenter defaultUserNotificationCenter].scheduledNotifications) {
644
- [formattedScheduledLocalNotifications addObject:RCTFormatUserNotification(notification)];
645
- }
646
- #endif // macOS]
647
- callback(@[ formattedScheduledLocalNotifications ]);
598
+ UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
599
+ [center getPendingNotificationRequestsWithCompletionHandler:^(NSArray<UNNotificationRequest *> *_Nonnull requests) {
600
+ NSMutableArray<NSDictionary *> *formattedScheduledLocalNotifications = [NSMutableArray new];
601
+ for (UNNotificationRequest *request in requests) {
602
+ [formattedScheduledLocalNotifications addObject:RCTFormatUNNotificationRequest(request)];
603
+ }
604
+ callback(@[ formattedScheduledLocalNotifications ]);
605
+ }];
648
606
  }
649
607
 
650
608
  RCT_EXPORT_METHOD(removeAllDeliveredNotifications)
651
609
  {
652
- #if !TARGET_OS_OSX // [macOS]
653
610
  UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
654
611
  [center removeAllDeliveredNotifications];
655
- #else // [macOS
656
- [[NSUserNotificationCenter defaultUserNotificationCenter] removeAllDeliveredNotifications];
657
- #endif // macOS]
658
612
  }
659
613
 
660
614
  RCT_EXPORT_METHOD(removeDeliveredNotifications : (NSArray<NSString *> *)identifiers)
661
615
  {
662
- #if !TARGET_OS_OSX // [macOS]
663
616
  UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
664
617
  [center removeDeliveredNotificationsWithIdentifiers:identifiers];
665
- #else // [macOS
666
- NSArray<NSUserNotification*> *notificationsToRemove = [[NSUserNotificationCenter defaultUserNotificationCenter].deliveredNotifications filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(NSUserNotification* evaluatedObject, NSDictionary<NSString *,id> * _Nullable bindings) {
667
- return [identifiers containsObject:evaluatedObject.identifier];
668
- }]];
669
- for (NSUserNotification *notification in notificationsToRemove) {
670
- [[NSUserNotificationCenter defaultUserNotificationCenter] removeDeliveredNotification:notification];
671
- }
672
- #endif // macOS]
673
618
  }
674
619
 
675
620
  RCT_EXPORT_METHOD(getDeliveredNotifications : (RCTResponseSenderBlock)callback)
676
621
  {
677
- #if !TARGET_OS_OSX // [macOS]
678
622
  UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
679
623
  [center getDeliveredNotificationsWithCompletionHandler:^(NSArray<UNNotification *> *_Nonnull notifications) {
680
624
  NSMutableArray<NSDictionary *> *formattedNotifications = [NSMutableArray new];
@@ -684,13 +628,6 @@ RCT_EXPORT_METHOD(getDeliveredNotifications : (RCTResponseSenderBlock)callback)
684
628
  }
685
629
  callback(@[ formattedNotifications ]);
686
630
  }];
687
- #else // [macOS
688
- NSMutableArray<NSDictionary *> *formattedNotifications = [NSMutableArray new];
689
- for (NSUserNotification *notification in [NSUserNotificationCenter defaultUserNotificationCenter].deliveredNotifications) {
690
- [formattedNotifications addObject:RCTFormatUserNotification(notification)];
691
- }
692
- callback(@[formattedNotifications]);
693
- #endif // macOS]
694
631
  }
695
632
 
696
633
  RCT_EXPORT_METHOD(getAuthorizationStatus : (RCTResponseSenderBlock)callback)
@@ -37,11 +37,18 @@
37
37
 
38
38
  @end
39
39
 
40
- @interface RCTTextView () <NSTextViewDelegate>
41
- @end
40
+ #endif // macOS]
41
+
42
+ #if !TARGET_OS_OSX // [macOS]
43
+ @interface RCTTextView () <UIEditMenuInteractionDelegate>
42
44
 
45
+ @property (nonatomic, nullable) UIEditMenuInteraction *editMenuInteraction API_AVAILABLE(ios(16.0));
46
+ #else // [macOS
47
+ @interface RCTTextView () <NSTextViewDelegate>
43
48
  #endif // macOS]
44
49
 
50
+ @end
51
+
45
52
  #import <QuartzCore/QuartzCore.h>
46
53
 
47
54
  @implementation RCTTextView {
@@ -351,6 +358,10 @@
351
358
  {
352
359
  _longPressGestureRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self
353
360
  action:@selector(handleLongPress:)];
361
+ if (@available(iOS 16.0, *)) {
362
+ _editMenuInteraction = [[UIEditMenuInteraction alloc] initWithDelegate:self];
363
+ [self addInteraction:_editMenuInteraction];
364
+ }
354
365
  [self addGestureRecognizer:_longPressGestureRecognizer];
355
366
  }
356
367
 
@@ -362,8 +373,16 @@
362
373
 
363
374
  - (void)handleLongPress:(UILongPressGestureRecognizer *)gesture
364
375
  {
365
- // TODO: Adopt showMenuFromRect (necessary for UIKitForMac)
366
376
  #if !TARGET_OS_UIKITFORMAC
377
+ if (@available(iOS 16.0, *)) {
378
+ CGPoint location = [gesture locationInView:self];
379
+ UIEditMenuConfiguration *config = [UIEditMenuConfiguration configurationWithIdentifier:nil sourcePoint:location];
380
+ if (_editMenuInteraction) {
381
+ [_editMenuInteraction presentEditMenuWithConfiguration:config];
382
+ }
383
+ return;
384
+ }
385
+ // TODO: Adopt showMenuFromRect (necessary for UIKitForMac)
367
386
  UIMenuController *menuController = [UIMenuController sharedMenuController];
368
387
 
369
388
  if (menuController.isMenuVisible) {
@@ -305,14 +305,14 @@ static CGFloat screenScale;
305
305
  void RCTComputeScreenScale(void)
306
306
  {
307
307
  dispatch_once(&onceTokenScreenScale, ^{
308
- screenScale = [UIScreen mainScreen].scale;
308
+ screenScale = [UITraitCollection currentTraitCollection].displayScale;
309
309
  });
310
310
  }
311
311
 
312
312
  CGFloat RCTScreenScale(void)
313
313
  {
314
314
  RCTUnsafeExecuteOnMainQueueOnceSync(&onceTokenScreenScale, ^{
315
- screenScale = [UIScreen mainScreen].scale;
315
+ screenScale = [UITraitCollection currentTraitCollection].displayScale;
316
316
  });
317
317
 
318
318
  return screenScale;
@@ -600,12 +600,20 @@ RCTUIWindow *__nullable RCTKeyWindow(void) // [macOS]
600
600
  return nil;
601
601
  }
602
602
 
603
- // TODO: replace with a more robust solution
604
- for (UIWindow *window in RCTSharedApplication().windows) {
605
- if (window.keyWindow) {
606
- return window;
603
+ for (UIScene *scene in RCTSharedApplication().connectedScenes) {
604
+ if (scene.activationState != UISceneActivationStateForegroundActive ||
605
+ ![scene isKindOfClass:[UIWindowScene class]]) {
606
+ continue;
607
+ }
608
+ UIWindowScene *windowScene = (UIWindowScene *)scene;
609
+
610
+ for (UIWindow *window in windowScene.windows) {
611
+ if (window.isKeyWindow) {
612
+ return window;
613
+ }
607
614
  }
608
615
  }
616
+
609
617
  return nil;
610
618
  #else // [macOS
611
619
  return [NSApp keyWindow];
@@ -634,12 +642,10 @@ BOOL RCTForceTouchAvailable(void)
634
642
  static BOOL forceSupported;
635
643
  static dispatch_once_t onceToken;
636
644
  dispatch_once(&onceToken, ^{
637
- forceSupported =
638
- [UITraitCollection class] && [UITraitCollection instancesRespondToSelector:@selector(forceTouchCapability)];
645
+ forceSupported = [UITraitCollection currentTraitCollection].forceTouchCapability == UIForceTouchCapabilityAvailable;
639
646
  });
640
647
 
641
- return forceSupported &&
642
- (RCTKeyWindow() ?: [UIView new]).traitCollection.forceTouchCapability == UIForceTouchCapabilityAvailable;
648
+ return forceSupported;
643
649
  }
644
650
  #endif // [macOS]
645
651
 
@@ -23,7 +23,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
23
23
  __rnVersion = @{
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(73),
26
- RCTVersionPatch: @(4),
26
+ RCTVersionPatch: @(6),
27
27
  RCTVersionPrerelease: [NSNull null],
28
28
  };
29
29
  });
@@ -23,17 +23,7 @@
23
23
  - (UIWindow *)alertWindow
24
24
  {
25
25
  if (_alertWindow == nil) {
26
- _alertWindow = [self getUIWindowFromScene];
27
-
28
- if (_alertWindow == nil) {
29
- UIWindow *keyWindow = RCTSharedApplication().keyWindow;
30
- if (keyWindow) {
31
- _alertWindow = [[UIWindow alloc] initWithFrame:keyWindow.bounds];
32
- } else {
33
- // keyWindow is nil, so we cannot create and initialize _alertWindow
34
- NSLog(@"Unable to create alert window: keyWindow is nil");
35
- }
36
- }
26
+ _alertWindow = [[UIWindow alloc] initWithWindowScene:RCTKeyWindow().windowScene];
37
27
 
38
28
  if (_alertWindow) {
39
29
  _alertWindow.rootViewController = [UIViewController new];
@@ -67,18 +57,6 @@
67
57
 
68
58
  _alertWindow = nil;
69
59
  }
70
-
71
- - (UIWindow *)getUIWindowFromScene
72
- {
73
- for (UIScene *scene in RCTSharedApplication().connectedScenes) {
74
- if (scene.activationState == UISceneActivationStateForegroundActive &&
75
- [scene isKindOfClass:[UIWindowScene class]]) {
76
- return [[UIWindow alloc] initWithWindowScene:(UIWindowScene *)scene];
77
- }
78
- }
79
-
80
- return nil;
81
- }
82
60
  #endif // [macOS]
83
61
 
84
62
  @end
@@ -120,15 +120,15 @@ RCT_EXPORT_MODULE()
120
120
 
121
121
  dispatch_async(dispatch_get_main_queue(), ^{
122
122
  self->_showDate = [NSDate date];
123
+
123
124
  if (!self->_window && !RCTRunningInTestEnvironment()) {
124
125
  #if !TARGET_OS_OSX // [macOS]
125
- CGSize screenSize = [UIScreen mainScreen].bounds.size;
126
+ UIWindow *window = RCTKeyWindow();
127
+ CGFloat windowWidth = window.bounds.size.width;
126
128
 
127
- UIWindow *window = RCTSharedApplication().keyWindow;
128
- self->_window =
129
- [[UIWindow alloc] initWithFrame:CGRectMake(0, 0, screenSize.width, window.safeAreaInsets.top + 10)];
130
- self->_label =
131
- [[UILabel alloc] initWithFrame:CGRectMake(0, window.safeAreaInsets.top - 10, screenSize.width, 20)];
129
+ self->_window = [[UIWindow alloc] initWithWindowScene:window.windowScene];
130
+ self->_window.frame = CGRectMake(0, 0, windowWidth, window.safeAreaInsets.top + 10);
131
+ self->_label = [[UILabel alloc] initWithFrame:CGRectMake(0, window.safeAreaInsets.top - 10, windowWidth, 20)];
132
132
  [self->_window addSubview:self->_label];
133
133
 
134
134
  self->_window.windowLevel = UIWindowLevelStatusBar + 1;
@@ -164,12 +164,10 @@ RCT_EXPORT_MODULE()
164
164
 
165
165
  self->_window.backgroundColor = backgroundColor;
166
166
  self->_window.hidden = NO;
167
-
168
- UIWindowScene *scene = (UIWindowScene *)RCTSharedApplication().connectedScenes.anyObject;
169
- self->_window.windowScene = scene;
170
167
  #else // [macOS
171
168
  self->_label.stringValue = message;
172
169
  self->_label.textColor = color;
170
+
173
171
  self->_label.backgroundColor = backgroundColor;
174
172
  [self->_window orderFront:nil];
175
173
  #endif // macOS]
@@ -27,6 +27,14 @@
27
27
 
28
28
  using namespace facebook::react;
29
29
 
30
+ #if !TARGET_OS_OSX // [macOS]
31
+ @interface RCTParagraphComponentView () <UIEditMenuInteractionDelegate>
32
+
33
+ @property (nonatomic, nullable) UIEditMenuInteraction *editMenuInteraction API_AVAILABLE(ios(16.0));
34
+
35
+ @end
36
+ #endif // [macOS]
37
+
30
38
  @implementation RCTParagraphComponentView {
31
39
  ParagraphShadowNode::ConcreteState::Shared _state;
32
40
  ParagraphAttributes _paragraphAttributes;
@@ -223,19 +231,36 @@ using namespace facebook::react;
223
231
  {
224
232
  _longPressGestureRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self
225
233
  action:@selector(handleLongPress:)];
234
+
235
+ if (@available(iOS 16.0, *)) {
236
+ _editMenuInteraction = [[UIEditMenuInteraction alloc] initWithDelegate:self];
237
+ [self addInteraction:_editMenuInteraction];
238
+ }
226
239
  [self addGestureRecognizer:_longPressGestureRecognizer];
227
240
  }
228
241
 
229
242
  - (void)disableContextMenu
230
243
  {
231
244
  [self removeGestureRecognizer:_longPressGestureRecognizer];
245
+ if (@available(iOS 16.0, *)) {
246
+ [self removeInteraction:_editMenuInteraction];
247
+ _editMenuInteraction = nil;
248
+ }
232
249
  _longPressGestureRecognizer = nil;
233
250
  }
234
251
 
235
252
  - (void)handleLongPress:(UILongPressGestureRecognizer *)gesture
236
253
  {
237
- // TODO: Adopt showMenuFromRect (necessary for UIKitForMac)
238
254
  #if !TARGET_OS_UIKITFORMAC
255
+ if (@available(iOS 16.0, *)) {
256
+ CGPoint location = [gesture locationInView:self];
257
+ UIEditMenuConfiguration *config = [UIEditMenuConfiguration configurationWithIdentifier:nil sourcePoint:location];
258
+ if (_editMenuInteraction) {
259
+ [_editMenuInteraction presentEditMenuWithConfiguration:config];
260
+ }
261
+ return;
262
+ }
263
+ // TODO: Adopt showMenuFromRect (necessary for UIKitForMac)
239
264
  UIMenuController *menuController = [UIMenuController sharedMenuController];
240
265
 
241
266
  if (menuController.isMenuVisible) {
@@ -263,7 +263,7 @@ using namespace facebook::react;
263
263
  if (oldViewProps.shouldRasterize != newViewProps.shouldRasterize) {
264
264
  self.layer.shouldRasterize = newViewProps.shouldRasterize;
265
265
  #if !TARGET_OS_OSX // [macOS]
266
- self.layer.rasterizationScale = newViewProps.shouldRasterize ? [UIScreen mainScreen].scale : 1.0;
266
+ self.layer.rasterizationScale = newViewProps.shouldRasterize ? self.traitCollection.displayScale : 1.0;
267
267
  #else // [macOS
268
268
  self.layer.rasterizationScale = 1.0;
269
269
  #endif // macOS]
@@ -15,8 +15,7 @@ RCTDimensions RCTGetDimensions(CGFloat fontScale)
15
15
  UIScreen *mainScreen = UIScreen.mainScreen;
16
16
  CGSize screenSize = mainScreen.bounds.size;
17
17
 
18
- UIView *mainWindow;
19
- mainWindow = RCTKeyWindow();
18
+ UIView *mainWindow = RCTKeyWindow();
20
19
  // We fallback to screen size if a key window is not found.
21
20
  CGSize windowSize = mainWindow ? mainWindow.bounds.size : screenSize;
22
21
  #else // [macOS
@@ -285,7 +285,7 @@ RCT_CUSTOM_VIEW_PROPERTY(shouldRasterizeIOS, BOOL, RCTView)
285
285
  {
286
286
  view.layer.shouldRasterize = json ? [RCTConvert BOOL:json] : defaultView.layer.shouldRasterize;
287
287
  view.layer.rasterizationScale =
288
- view.layer.shouldRasterize ? [UIScreen mainScreen].scale : defaultView.layer.rasterizationScale;
288
+ view.layer.shouldRasterize ? view.traitCollection.displayScale : defaultView.layer.rasterizationScale;
289
289
  }
290
290
  #endif // [macOS]
291
291
 
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.73.4
1
+ VERSION_NAME=0.73.6
2
2
  react.internal.publishingGroup=com.facebook.react
3
3
 
4
4
  android.useAndroidX=true
@@ -17,6 +17,6 @@ public class ReactNativeVersion {
17
17
  public static final Map<String, Object> VERSION = MapBuilder.<String, Object>of(
18
18
  "major", 0,
19
19
  "minor", 73,
20
- "patch", 4,
20
+ "patch", 6,
21
21
  "prerelease", null);
22
22
  }
@@ -17,7 +17,7 @@ namespace facebook::react {
17
17
  constexpr struct {
18
18
  int32_t Major = 0;
19
19
  int32_t Minor = 73;
20
- int32_t Patch = 4;
20
+ int32_t Patch = 6;
21
21
  std::string_view Prerelease = "";
22
22
  } ReactNativeVersion;
23
23
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-macos",
3
- "version": "0.73.4",
3
+ "version": "0.73.6",
4
4
  "description": "React Native for macOS",
5
5
  "license": "MIT",
6
6
  "repository": {