react-native-macos 0.72.14 → 0.72.16

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.
Files changed (72) hide show
  1. package/Libraries/AppDelegate/RCTAppDelegate.h +2 -1
  2. package/Libraries/AppDelegate/RCTAppDelegate.mm +17 -1
  3. package/Libraries/Core/ReactNativeVersion.js +1 -1
  4. package/Libraries/Image/RCTUIImageViewAnimated.m +0 -5
  5. package/Libraries/Network/React-RCTNetwork.podspec +4 -1
  6. package/Libraries/PushNotificationIOS/RCTPushNotificationManager.h +2 -2
  7. package/Libraries/PushNotificationIOS/RCTPushNotificationManager.mm +9 -111
  8. package/Libraries/Text/React-RCTText.podspec +1 -0
  9. package/Libraries/Text/Text/RCTTextView.m +7 -15
  10. package/Libraries/Text/TextInput/RCTBaseTextInputView.m +2 -6
  11. package/Libraries/Text/TextInput/Singleline/macOS/RCTUISecureTextField.h +3 -0
  12. package/Libraries/Text/TextInput/Singleline/macOS/RCTUISecureTextField.m +2 -0
  13. package/React/Base/RCTConstants.h +2 -0
  14. package/React/Base/RCTConstants.m +2 -0
  15. package/React/Base/RCTConvert.m +2 -0
  16. package/React/Base/RCTKeyCommands.m +5 -1
  17. package/React/Base/RCTRootContentView.m +2 -6
  18. package/React/Base/RCTUIKit.h +4 -2
  19. package/React/Base/RCTUtils.h +8 -3
  20. package/React/Base/RCTUtils.m +19 -3
  21. package/React/Base/RCTVersion.m +1 -1
  22. package/React/Base/macOS/RCTUIKit.m +8 -4
  23. package/React/CoreModules/RCTDeviceInfo.h +0 -7
  24. package/React/CoreModules/RCTDeviceInfo.mm +41 -47
  25. package/React/CoreModules/RCTPerfMonitor.mm +7 -1
  26. package/React/CoreModules/RCTRedBox.mm +6 -0
  27. package/React/CoreModules/RCTStatusBarManager.mm +50 -15
  28. package/React/CoreModules/React-CoreModules.podspec +1 -1
  29. package/React/Fabric/Mounting/ComponentViews/ActivityIndicator/RCTActivityIndicatorViewComponentView.mm +8 -0
  30. package/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryComponentView.mm +4 -0
  31. package/React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.mm +8 -0
  32. package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +6 -4
  33. package/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm +7 -15
  34. package/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm +3 -1
  35. package/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.mm +2 -2
  36. package/React/Fabric/RCTSurfacePointerHandler.mm +8 -1
  37. package/React/Fabric/RCTSurfaceTouchHandler.mm +4 -0
  38. package/React/Modules/RCTUIManager.m +4 -2
  39. package/React/UIUtils/RCTUIUtils.h +0 -4
  40. package/React/UIUtils/RCTUIUtils.m +39 -45
  41. package/React/Views/RCTActivityIndicatorView.m +8 -4
  42. package/React/Views/RCTActivityIndicatorViewManager.m +11 -1
  43. package/React/Views/RCTModalHostView.m +2 -0
  44. package/React/Views/RCTModalHostViewController.m +8 -0
  45. package/React/Views/RCTWrapperViewController.m +2 -0
  46. package/React/Views/ScrollView/RCTScrollView.m +4 -0
  47. package/React/Views/ScrollView/RCTScrollViewManager.h +2 -0
  48. package/React/Views/ScrollView/RCTScrollViewManager.m +4 -2
  49. package/React-Core.podspec +1 -1
  50. package/ReactAndroid/gradle.properties +1 -1
  51. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
  52. package/ReactAndroid/src/main/jni/third-party/fmt/CMakeLists.txt +1 -1
  53. package/ReactCommon/React-Fabric.podspec +1 -0
  54. package/ReactCommon/ReactCommon.podspec +1 -0
  55. package/ReactCommon/cxxreact/React-cxxreact.podspec +1 -0
  56. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  57. package/ReactCommon/hermes/React-hermes.podspec +1 -0
  58. package/ReactCommon/jsi/React-jsi.podspec +1 -0
  59. package/ReactCommon/jsiexecutor/React-jsiexecutor.podspec +1 -0
  60. package/ReactCommon/react/bridging/Base.h +2 -3
  61. package/ReactCommon/react/bridging/Function.h +7 -10
  62. package/ReactCommon/react/nativemodule/core/platform/android/ReactCommon/JavaTurboModule.cpp +0 -1
  63. package/ReactCommon/react/nativemodule/samples/platform/ios/ReactCommon/RCTSampleTurboModule.mm +4 -0
  64. package/package.json +1 -1
  65. package/scripts/cocoapods/helpers.rb +5 -0
  66. package/scripts/cocoapods/utils.rb +1 -0
  67. package/scripts/react_native_pods.rb +9 -1
  68. package/template/package.json +1 -1
  69. package/third-party-podspecs/RCT-Folly.podspec +1 -1
  70. package/third-party-podspecs/SocketRocket.podspec +30 -0
  71. package/third-party-podspecs/fmt.podspec +25 -0
  72. package/ReactCommon/butter/function.h +0 -51
@@ -50,10 +50,11 @@
50
50
  * - (id<RCTTurboModule>)getModuleInstanceFromClass:(Class)moduleClass
51
51
  */
52
52
  #if !TARGET_OS_OSX // [macOS]
53
- @interface RCTAppDelegate : UIResponder <UIApplicationDelegate, RCTBridgeDelegate>
53
+ @interface RCTAppDelegate : UIResponder <UIApplicationDelegate, UISceneDelegate, RCTBridgeDelegate>
54
54
  #else // [macOS
55
55
  @interface RCTAppDelegate : NSResponder <NSApplicationDelegate, RCTBridgeDelegate>
56
56
  #endif // macOS]
57
+
57
58
  /// The window object, used to render the UViewControllers
58
59
  @property (nonatomic, strong) RCTPlatformWindow *window; // [macOS]
59
60
  @property (nonatomic, strong) RCTBridge *bridge;
@@ -85,15 +85,20 @@ static NSString *const kRNConcurrentRoot = @"concurrentRoot";
85
85
  RCTPlatformView *rootView = [self createRootViewWithBridge:self.bridge moduleName:self.moduleName initProps:initProps]; // [macOS]
86
86
 
87
87
  #if !TARGET_OS_OSX // [macOS
88
+ #if !TARGET_OS_VISION // [visionOS]
88
89
  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
90
+ #else
91
+ self.window = [[UIWindow alloc] initWithFrame:CGRectMake(0, 0, 1280, 720)];
92
+ #endif // [visionOS]
89
93
  UIViewController *rootViewController = [self createRootViewController];
90
94
  rootViewController.view = rootView;
91
95
  self.window.rootViewController = rootViewController;
96
+ self.window.windowScene.delegate = self;
92
97
  [self.window makeKeyAndVisible];
93
98
 
94
99
  return YES;
95
100
  #else // [macOS
96
- NSRect frame = NSMakeRect(0,0,1024,768);
101
+ NSRect frame = NSMakeRect(0,0,1280,720);
97
102
  self.window = [[NSWindow alloc] initWithContentRect:NSZeroRect
98
103
  styleMask:NSWindowStyleMaskTitled | NSWindowStyleMaskResizable | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable
99
104
  backing:NSBackingStoreBuffered
@@ -173,6 +178,17 @@ static NSString *const kRNConcurrentRoot = @"concurrentRoot";
173
178
  return YES;
174
179
  }
175
180
 
181
+ #pragma mark - UISceneDelegate
182
+ #if !TARGET_OS_OSX // [macOS]
183
+ - (void)windowScene:(UIWindowScene *)windowScene
184
+ didUpdateCoordinateSpace:(id<UICoordinateSpace>)previousCoordinateSpace
185
+ interfaceOrientation:(UIInterfaceOrientation)previousInterfaceOrientation
186
+ traitCollection:(UITraitCollection *)previousTraitCollection API_AVAILABLE(ios(13.0))
187
+ {
188
+ [[NSNotificationCenter defaultCenter] postNotificationName:RCTWindowFrameDidChangeNotification object:self];
189
+ }
190
+ #endif // [macOS]
191
+
176
192
  #pragma mark - RCTCxxBridgeDelegate
177
193
  - (std::unique_ptr<facebook::react::JSExecutorFactory>)jsExecutorFactoryForBridge:(RCTBridge *)bridge
178
194
  {
@@ -12,6 +12,6 @@
12
12
  exports.version = {
13
13
  major: 0,
14
14
  minor: 72,
15
- patch: 14,
15
+ patch: 16,
16
16
  prerelease: null,
17
17
  };
@@ -193,15 +193,10 @@ static NSUInteger RCTDeviceFreeMemory()
193
193
 
194
194
  - (void)displayDidRefresh:(CADisplayLink *)displayLink
195
195
  {
196
- #if TARGET_OS_UIKITFORMAC
197
- // TODO: `displayLink.frameInterval` is not available on UIKitForMac
198
- NSTimeInterval durationToNextRefresh = displayLink.duration;
199
- #else
200
196
  // displaylink.duration -- time interval between frames, assuming maximumFramesPerSecond
201
197
  // displayLink.preferredFramesPerSecond (>= iOS 10) -- Set to 30 for displayDidRefresh to be called at 30 fps
202
198
  // durationToNextRefresh -- Time interval to the next time displayDidRefresh is called
203
199
  NSTimeInterval durationToNextRefresh = displayLink.targetTimestamp - displayLink.timestamp;
204
- #endif
205
200
  NSUInteger totalFrameCount = self.totalFrameCount;
206
201
  NSUInteger currentFrameIndex = self.currentFrameIndex;
207
202
  NSUInteger nextFrameIndex = (currentFrameIndex + 1) % totalFrameCount;
@@ -54,7 +54,10 @@ Pod::Spec.new do |s|
54
54
  "CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
55
55
  "HEADER_SEARCH_PATHS" => header_search_paths.join(' ')
56
56
  }
57
- s.ios.frameworks = "MobileCoreServices" # [macOS] Restrict to iOS
57
+ # [macOS MobileCoreServices Not available on macOS
58
+ s.ios.frameworks = "MobileCoreServices"
59
+ s.visionos.frameworks = "MobileCoreServices"
60
+ # macOS]
58
61
 
59
62
  s.dependency "RCT-Folly", folly_version
60
63
  s.dependency "React-Codegen", version
@@ -15,18 +15,18 @@ extern NSString *const RCTRemoteNotificationReceived;
15
15
  typedef void (^RCTRemoteNotificationCallback)(UIBackgroundFetchResult result);
16
16
  #endif // [macOS]
17
17
 
18
- #if !TARGET_OS_UIKITFORMAC
19
18
  + (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken;
20
19
  + (void)didReceiveRemoteNotification:(NSDictionary *)notification;
21
20
  #if !TARGET_OS_OSX // [macOS]
22
21
  + (void)didReceiveRemoteNotification:(NSDictionary *)notification
23
22
  fetchCompletionHandler:(RCTRemoteNotificationCallback)completionHandler;
23
+ #if TARGET_OS_IOS // [visionOS]
24
24
  + (void)didReceiveLocalNotification:(UILocalNotification *)notification;
25
+ #endif // [visionOS]
25
26
  #endif // [macOS]
26
27
  #if TARGET_OS_OSX // [macOS
27
28
  + (void)didReceiveUserNotification:(NSUserNotification *)notification;
28
29
  #endif // macOS]
29
30
  + (void)didFailToRegisterForRemoteNotificationsWithError:(NSError *)error;
30
- #endif
31
31
 
32
32
  @end
@@ -24,8 +24,6 @@ static NSString *const kRemoteNotificationRegistrationFailed = @"RemoteNotificat
24
24
 
25
25
  static NSString *const kErrorUnableToRequestPermissions = @"E_UNABLE_TO_REQUEST_PERMISSIONS";
26
26
 
27
- #if !TARGET_OS_UIKITFORMAC
28
-
29
27
  @interface RCTPushNotificationManager () <NativePushNotificationManagerIOSSpec>
30
28
  @property (nonatomic, strong) NSMutableDictionary *remoteNotificationCallbacks;
31
29
  @end
@@ -97,16 +95,10 @@ RCT_ENUM_CONVERTER(
97
95
 
98
96
  @end
99
97
  #endif // [macOS]
100
- #else
101
- @interface RCTPushNotificationManager () <NativePushNotificationManagerIOSSpec>
102
- @end
103
- #endif // TARGET_OS_UIKITFORMAC
104
98
 
105
99
  @implementation RCTPushNotificationManager
106
100
 
107
- #if !TARGET_OS_UIKITFORMAC
108
-
109
- #if !TARGET_OS_OSX // [macOS]
101
+ #if TARGET_OS_IOS // [macOS] [visionOS]
110
102
  /** DEPRECATED. UILocalNotification was deprecated in iOS 10. Please don't add new callsites. */
111
103
  static NSDictionary *RCTFormatLocalNotification(UILocalNotification *notification)
112
104
  {
@@ -126,7 +118,8 @@ static NSDictionary *RCTFormatLocalNotification(UILocalNotification *notificatio
126
118
  formattedLocalNotification[@"remote"] = @NO;
127
119
  return formattedLocalNotification;
128
120
  }
129
- #else // [macOS
121
+ #endif // [macOS] [visionOS]
122
+ #if TARGET_OS_OSX // [macOS
130
123
  static NSDictionary *RCTFormatUserNotification(NSUserNotification *notification)
131
124
  {
132
125
  NSMutableDictionary *formattedUserNotification = [NSMutableDictionary dictionary];
@@ -198,8 +191,6 @@ static NSString *RCTFormatNotificationDateFromNSDate(NSDate *date)
198
191
  return [formatter stringFromDate:date];
199
192
  }
200
193
 
201
- #endif // TARGET_OS_UIKITFORMAC
202
-
203
194
  RCT_EXPORT_MODULE()
204
195
 
205
196
  - (dispatch_queue_t)methodQueue
@@ -207,7 +198,6 @@ RCT_EXPORT_MODULE()
207
198
  return dispatch_get_main_queue();
208
199
  }
209
200
 
210
- #if !TARGET_OS_UIKITFORMAC
211
201
  - (void)startObserving
212
202
  {
213
203
  [[NSNotificationCenter defaultCenter] addObserver:self
@@ -282,14 +272,15 @@ RCT_EXPORT_MODULE()
282
272
  }
283
273
  #endif // [macOS]
284
274
 
285
- #if !TARGET_OS_OSX // [macOS]
275
+ #if TARGET_OS_IOS // [macOS] [visionOS]
286
276
  + (void)didReceiveLocalNotification:(UILocalNotification *)notification
287
277
  {
288
278
  [[NSNotificationCenter defaultCenter] postNotificationName:kLocalNotificationReceived
289
279
  object:self
290
280
  userInfo:RCTFormatLocalNotification(notification)];
291
281
  }
292
- #else // [macOS
282
+ #endif // [macOS] [visionOS]
283
+ #if TARGET_OS_OSX // [macOS
293
284
  + (void)didReceiveUserNotification:(NSUserNotification *)notification
294
285
  {
295
286
  NSString *notificationName = notification.isRemote ? RCTRemoteNotificationReceived : kLocalNotificationReceived;
@@ -568,7 +559,7 @@ RCT_EXPORT_METHOD(getInitialNotification
568
559
  : (RCTPromiseResolveBlock)resolve reject
569
560
  : (__unused RCTPromiseRejectBlock)reject)
570
561
  {
571
- #if !TARGET_OS_OSX // [macOS]
562
+ #if TARGET_OS_IOS // [macOS] [visionOS]
572
563
  NSMutableDictionary<NSString *, id> *initialNotification =
573
564
  [self.bridge.launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey] mutableCopy];
574
565
 
@@ -583,7 +574,8 @@ RCT_EXPORT_METHOD(getInitialNotification
583
574
  } else {
584
575
  resolve((id)kCFNull);
585
576
  }
586
- #else // [macOS
577
+ #endif // [macOS] [visionOS]
578
+ #if TARGET_OS_OSX // [macOS
587
579
  NSUserNotification *initialNotification = self.bridge.launchOptions[NSApplicationLaunchUserNotificationKey];
588
580
  if (initialNotification) {
589
581
  resolve(RCTFormatUserNotification(initialNotification));
@@ -638,100 +630,6 @@ RCT_EXPORT_METHOD(getAuthorizationStatus : (RCTResponseSenderBlock)callback)
638
630
  }];
639
631
  }
640
632
 
641
- #else // TARGET_OS_UIKITFORMAC
642
-
643
- RCT_EXPORT_METHOD(onFinishRemoteNotification : (NSString *)notificationId fetchResult : (NSString *)fetchResult)
644
- {
645
- RCTLogError(@"Not implemented: %@", NSStringFromSelector(_cmd));
646
- }
647
-
648
- RCT_EXPORT_METHOD(setApplicationIconBadgeNumber : (double)number)
649
- {
650
- RCTLogError(@"Not implemented: %@", NSStringFromSelector(_cmd));
651
- }
652
-
653
- RCT_EXPORT_METHOD(getApplicationIconBadgeNumber : (RCTResponseSenderBlock)callback)
654
- {
655
- RCTLogError(@"Not implemented: %@", NSStringFromSelector(_cmd));
656
- }
657
-
658
- RCT_EXPORT_METHOD(requestPermissions
659
- : (JS::NativePushNotificationManagerIOS::SpecRequestPermissionsPermission &)permissions resolve
660
- : (RCTPromiseResolveBlock)resolve reject
661
- : (RCTPromiseRejectBlock)reject)
662
- {
663
- RCTLogError(@"Not implemented: %@", NSStringFromSelector(_cmd));
664
- }
665
-
666
- RCT_EXPORT_METHOD(abandonPermissions)
667
- {
668
- RCTLogError(@"Not implemented: %@", NSStringFromSelector(_cmd));
669
- }
670
-
671
- RCT_EXPORT_METHOD(checkPermissions : (RCTResponseSenderBlock)callback)
672
- {
673
- RCTLogError(@"Not implemented: %@", NSStringFromSelector(_cmd));
674
- }
675
-
676
- RCT_EXPORT_METHOD(presentLocalNotification : (JS::NativePushNotificationManagerIOS::Notification &)notification)
677
- {
678
- RCTLogError(@"Not implemented: %@", NSStringFromSelector(_cmd));
679
- }
680
-
681
- RCT_EXPORT_METHOD(scheduleLocalNotification : (JS::NativePushNotificationManagerIOS::Notification &)notification)
682
- {
683
- RCTLogError(@"Not implemented: %@", NSStringFromSelector(_cmd));
684
- }
685
-
686
- RCT_EXPORT_METHOD(cancelAllLocalNotifications)
687
- {
688
- RCTLogError(@"Not implemented: %@", NSStringFromSelector(_cmd));
689
- }
690
-
691
- RCT_EXPORT_METHOD(cancelLocalNotifications : (NSDictionary<NSString *, id> *)userInfo)
692
- {
693
- RCTLogError(@"Not implemented: %@", NSStringFromSelector(_cmd));
694
- }
695
-
696
- RCT_EXPORT_METHOD(getInitialNotification
697
- : (RCTPromiseResolveBlock)resolve reject
698
- : (__unused RCTPromiseRejectBlock)reject)
699
- {
700
- RCTLogError(@"Not implemented: %@", NSStringFromSelector(_cmd));
701
- }
702
-
703
- RCT_EXPORT_METHOD(getScheduledLocalNotifications : (RCTResponseSenderBlock)callback)
704
- {
705
- RCTLogError(@"Not implemented: %@", NSStringFromSelector(_cmd));
706
- }
707
-
708
- RCT_EXPORT_METHOD(removeAllDeliveredNotifications)
709
- {
710
- RCTLogError(@"Not implemented: %@", NSStringFromSelector(_cmd));
711
- }
712
-
713
- RCT_EXPORT_METHOD(removeDeliveredNotifications : (NSArray<NSString *> *)identifiers)
714
- {
715
- RCTLogError(@"Not implemented: %@", NSStringFromSelector(_cmd));
716
- }
717
-
718
- RCT_EXPORT_METHOD(getDeliveredNotifications : (RCTResponseSenderBlock)callback)
719
- {
720
- RCTLogError(@"Not implemented: %@", NSStringFromSelector(_cmd));
721
- }
722
-
723
- RCT_EXPORT_METHOD(getAuthorizationStatus : (RCTResponseSenderBlock)callback)
724
- {
725
- RCTLogError(@"Not implemented: %@", NSStringFromSelector(_cmd));
726
- }
727
-
728
- - (NSArray<NSString *> *)supportedEvents
729
- {
730
- return @[];
731
- }
732
-
733
- #endif // TARGET_OS_UIKITFORMAC
734
-
735
633
  - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
736
634
  (const facebook::react::ObjCTurboModule::InitParams &)params
737
635
  {
@@ -28,6 +28,7 @@ Pod::Spec.new do |s|
28
28
  s.source = source
29
29
  s.source_files = "**/*.{h,m}"
30
30
  s.ios.exclude_files = "**/macOS/*" # [macOS]
31
+ s.visionos.exclude_files = "**/macOS/*" # [visionOS]
31
32
  s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs"
32
33
  s.header_dir = "RCTText"
33
34
 
@@ -380,29 +380,21 @@
380
380
 
381
381
  - (void)handleLongPress:(UILongPressGestureRecognizer *)gesture
382
382
  {
383
- #if !TARGET_OS_UIKITFORMAC
384
- if (@available(iOS 16.0, *)) {
383
+ if (@available(iOS 16.0, macCatalyst 16.0, *)) {
385
384
  CGPoint location = [gesture locationInView:self];
386
385
  UIEditMenuConfiguration *config = [UIEditMenuConfiguration configurationWithIdentifier:nil sourcePoint:location];
387
386
  if (_editMenuInteraction) {
388
387
  [_editMenuInteraction presentEditMenuWithConfiguration:config];
389
388
  }
390
- return;
391
- }
392
- // TODO: Adopt showMenuFromRect (necessary for UIKitForMac)
393
- UIMenuController *menuController = [UIMenuController sharedMenuController];
389
+ } else {
390
+ UIMenuController *menuController = [UIMenuController sharedMenuController];
394
391
 
395
- if (menuController.isMenuVisible) {
396
- return;
397
- }
392
+ if (menuController.isMenuVisible) {
393
+ return;
394
+ }
398
395
 
399
- if (!self.isFirstResponder) {
400
- [self becomeFirstResponder];
396
+ [menuController showMenuFromView:self rect:self.bounds];
401
397
  }
402
-
403
- [menuController setTargetRect:self.bounds inView:self];
404
- [menuController setMenuVisible:YES animated:YES];
405
- #endif
406
398
  }
407
399
  #else // [macOS
408
400
 
@@ -807,6 +807,7 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)decoder)
807
807
 
808
808
  #pragma mark - Custom Input Accessory View
809
809
 
810
+ #if TARGET_OS_IOS // [macOS] [visionOS]
810
811
  - (void)didSetProps:(NSArray<NSString *> *)changedProps
811
812
  {
812
813
  if ([changedProps containsObject:@"inputAccessoryViewID"] && self.inputAccessoryViewID) {
@@ -818,7 +819,6 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)decoder)
818
819
 
819
820
  - (void)setCustomInputAccessoryViewWithNativeID:(NSString *)nativeID
820
821
  {
821
- #if !TARGET_OS_OSX // [macOS]
822
822
  __weak RCTBaseTextInputView *weakSelf = self;
823
823
  [_bridge.uiManager rootViewForReactTag:self.reactTag
824
824
  withCompletion:^(UIView *rootView) {
@@ -833,12 +833,10 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)decoder)
833
833
  }
834
834
  }
835
835
  }];
836
- #endif // [macOS]
837
836
  }
838
837
 
839
838
  - (void)setDefaultInputAccessoryView
840
839
  {
841
- #if !TARGET_OS_OSX // [macOS]
842
840
  UIView<RCTBackedTextInputViewProtocol> *textInputView = self.backedTextInputView;
843
841
  UIKeyboardType keyboardType = textInputView.keyboardType;
844
842
 
@@ -870,10 +868,8 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)decoder)
870
868
  textInputView.inputAccessoryView = nil;
871
869
  }
872
870
  [self reloadInputViewsIfNecessary];
873
- #endif // [macOS]
874
871
  }
875
872
 
876
- #if !TARGET_OS_OSX // [macOS]
877
873
  - (void)reloadInputViewsIfNecessary
878
874
  {
879
875
  // We have to call `reloadInputViews` for focused text inputs to update an accessory view.
@@ -890,7 +886,7 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)decoder)
890
886
  [self.backedTextInputView endEditing:YES];
891
887
  }
892
888
  }
893
- #endif // [macOS]
889
+ #endif // [macOS] [visionOS]
894
890
 
895
891
  // [macOS
896
892
 
@@ -7,6 +7,9 @@
7
7
 
8
8
  // [macOS]
9
9
 
10
+ #if TARGET_OS_OSX
10
11
  #define RCT_SUBCLASS_SECURETEXTFIELD 1
12
+ #endif
11
13
 
12
14
  #include <React/RCTUITextField.h>
15
+
@@ -7,6 +7,8 @@
7
7
 
8
8
  // [macOS]
9
9
 
10
+ #if TARGET_OS_OSX
10
11
  #define RCT_SUBCLASS_SECURETEXTFIELD 1
12
+ #endif
11
13
 
12
14
  #include "../RCTUITextField.m"
@@ -10,6 +10,8 @@
10
10
  RCT_EXTERN NSString *const RCTUserInterfaceStyleDidChangeNotification;
11
11
  RCT_EXTERN NSString *const RCTUserInterfaceStyleDidChangeNotificationTraitCollectionKey;
12
12
 
13
+ RCT_EXTERN NSString *const RCTWindowFrameDidChangeNotification;
14
+
13
15
  /**
14
16
  * This notification fires when the bridge initializes.
15
17
  */
@@ -10,6 +10,8 @@
10
10
  NSString *const RCTUserInterfaceStyleDidChangeNotification = @"RCTUserInterfaceStyleDidChangeNotification";
11
11
  NSString *const RCTUserInterfaceStyleDidChangeNotificationTraitCollectionKey = @"traitCollection";
12
12
 
13
+ NSString *const RCTWindowFrameDidChangeNotification = @"RCTWindowFrameDidChangeNotification";
14
+
13
15
  NSString *const RCTJavaScriptDidFailToLoadNotification = @"RCTJavaScriptDidFailToLoadNotification";
14
16
  NSString *const RCTJavaScriptDidLoadNotification = @"RCTJavaScriptDidLoadNotification";
15
17
  NSString *const RCTJavaScriptWillStartExecutingNotification = @"RCTJavaScriptWillStartExecutingNotification";
@@ -544,8 +544,10 @@ RCT_ENUM_CONVERTER(
544
544
  (@{
545
545
  @"default" : @(UIBarStyleDefault),
546
546
  @"black" : @(UIBarStyleBlack),
547
+ #if !TARGET_OS_VISION // [visionOS]
547
548
  @"blackOpaque" : @(UIBarStyleBlackOpaque),
548
549
  @"blackTranslucent" : @(UIBarStyleBlackTranslucent),
550
+ #endif // [visionOS]
549
551
  }),
550
552
  UIBarStyleDefault,
551
553
  integerValue)
@@ -131,7 +131,11 @@ RCT_NOT_IMPLEMENTED(-(instancetype)init)
131
131
  isKeyDown = [event _isKeyDown];
132
132
  }
133
133
 
134
- BOOL interactionEnabled = !RCTSharedApplication().isIgnoringInteractionEvents;
134
+ #if !TARGET_OS_VISION // [visionOS]
135
+ BOOL interactionEnabled = !RCTSharedApplication().isIgnoringInteractionEvents;
136
+ #else // [visionOS
137
+ BOOL interactionEnabled = true;
138
+ #endif // visionOS]
135
139
  BOOL hasFirstResponder = NO;
136
140
  if (isKeyDown && modifiedInput.length > 0 && interactionEnabled) {
137
141
  UIResponder *firstResponder = nil;
@@ -8,7 +8,7 @@
8
8
  #import "RCTRootContentView.h"
9
9
 
10
10
  #import "RCTBridge.h"
11
- #import "RCTDeviceInfo.h" // [macOS]
11
+ #import "RCTConstants.h" // [macOS]
12
12
  #import "RCTPerformanceLogger.h"
13
13
  #import "RCTRootView.h"
14
14
  #import "RCTRootViewInternal.h"
@@ -78,11 +78,7 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (nonnull NSCoder *)aDecoder)
78
78
 
79
79
  - (void)sendFrameChangedEvent:(__unused NSNotification *)notification
80
80
  {
81
- #pragma clang diagnostic push
82
- #pragma clang diagnostic ignored "-Wdeprecated-declarations"
83
- [_bridge.eventDispatcher sendDeviceEventWithName:@"didUpdateDimensions"
84
- body:RCTExportedDimensions(self, self.bridge)];
85
- #pragma clang diagnostic pop
81
+ [[NSNotificationCenter defaultCenter] postNotificationName:RCTWindowFrameDidChangeNotification object:self];
86
82
  }
87
83
 
88
84
  #endif // macOS]
@@ -227,8 +227,8 @@ enum : NSInteger
227
227
 
228
228
  // RCTActivityIndicatorView.h
229
229
  typedef NS_ENUM(NSInteger, UIActivityIndicatorViewStyle) {
230
- UIActivityIndicatorViewStyleWhiteLarge,
231
- UIActivityIndicatorViewStyleWhite
230
+ UIActivityIndicatorViewStyleLarge,
231
+ UIActivityIndicatorViewStyleMedium,
232
232
  };
233
233
 
234
234
 
@@ -486,8 +486,10 @@ NS_ASSUME_NONNULL_END
486
486
 
487
487
  #if !TARGET_OS_OSX
488
488
  typedef UIApplication RCTUIApplication;
489
+ typedef UIWindow RCTUIWindow;
489
490
  #else
490
491
  typedef NSApplication RCTUIApplication;
492
+ typedef NSWindow RCTUIWindow;
491
493
  #endif
492
494
 
493
495
  //
@@ -93,13 +93,18 @@ RCT_EXTERN BOOL RCTRunningInAppExtension(void);
93
93
  #endif // [macOS]
94
94
 
95
95
  // Returns the shared UIApplication instance, or nil if running in an App Extension
96
- RCT_EXTERN UIApplication *__nullable RCTSharedApplication(void);
96
+ RCT_EXTERN RCTUIApplication *__nullable RCTSharedApplication(void); // [macOS]
97
97
 
98
- #if !TARGET_OS_OSX // [macOS]
99
98
  // Returns the current main window, useful if you need to access the root view
100
99
  // or view controller
101
- RCT_EXTERN UIWindow *__nullable RCTKeyWindow(void);
100
+ RCT_EXTERN RCTUIWindow *__nullable RCTKeyWindow(void); // [macOS]
101
+
102
+ #if TARGET_OS_VISION // [visionOS
103
+ // Returns UIStatusBarManager to get it's configuration info.
104
+ RCT_EXTERN UIStatusBarManager *__nullable RCTUIStatusBarManager(void);
105
+ #endif // visionOS]
102
106
 
107
+ #if !TARGET_OS_OSX // [macOS]
103
108
  // Returns the presented view controller, useful if you need
104
109
  // e.g. to present a modal view controller or alert over it
105
110
  RCT_EXTERN UIViewController *__nullable RCTPresentedViewController(void);
@@ -352,7 +352,11 @@ CGSize RCTScreenSize()
352
352
  static dispatch_once_t onceToken;
353
353
  dispatch_once(&onceToken, ^{
354
354
  RCTUnsafeExecuteOnMainQueueSync(^{
355
+ #if TARGET_OS_IOS // [visionOS]
355
356
  size = [UIScreen mainScreen].bounds.size;
357
+ #else // [visionOS
358
+ size = RCTKeyWindow().bounds.size;
359
+ #endif // visionOS]
356
360
  });
357
361
  });
358
362
 
@@ -581,7 +585,7 @@ BOOL RCTRunningInAppExtension(void)
581
585
  }
582
586
  #endif // [macOS]
583
587
 
584
- UIApplication *__nullable RCTSharedApplication(void)
588
+ RCTUIApplication *__nullable RCTSharedApplication(void) // [macOS]
585
589
  {
586
590
  #if !TARGET_OS_OSX // [macOS]
587
591
  if (RCTRunningInAppExtension()) {
@@ -593,9 +597,9 @@ UIApplication *__nullable RCTSharedApplication(void)
593
597
  #endif // macOS]
594
598
  }
595
599
 
596
- #if !TARGET_OS_OSX // [macOS]
597
- UIWindow *__nullable RCTKeyWindow(void)
600
+ RCTUIWindow *__nullable RCTKeyWindow(void) // [macOS]
598
601
  {
602
+ #if !TARGET_OS_OSX // [macOS]
599
603
  if (RCTRunningInAppExtension()) {
600
604
  return nil;
601
605
  }
@@ -615,8 +619,20 @@ UIWindow *__nullable RCTKeyWindow(void)
615
619
  }
616
620
 
617
621
  return nil;
622
+ #else // [macOS
623
+ return [NSApp keyWindow];
624
+ #endif // macOS]
618
625
  }
619
626
 
627
+ #if TARGET_OS_VISION // [visionOS
628
+ UIStatusBarManager *__nullable RCTUIStatusBarManager(void) {
629
+ NSSet *connectedScenes = RCTSharedApplication().connectedScenes;
630
+ UIWindowScene *windowScene = [connectedScenes anyObject];
631
+ return windowScene.statusBarManager;
632
+ }
633
+ #endif // visionOS]
634
+
635
+ #if !TARGET_OS_OSX // [macOS]
620
636
  UIViewController *__nullable RCTPresentedViewController(void)
621
637
  {
622
638
  if ([RCTUtilsUIOverride hasPresentedViewController]) {
@@ -23,7 +23,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
23
23
  __rnVersion = @{
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(72),
26
- RCTVersionPatch: @(14),
26
+ RCTVersionPatch: @(16),
27
27
  RCTVersionPrerelease: [NSNull null],
28
28
  };
29
29
  });
@@ -698,11 +698,15 @@ BOOL RCTUIViewSetClipsToBounds(RCTPlatformView *view)
698
698
  _activityIndicatorViewStyle = activityIndicatorViewStyle;
699
699
 
700
700
  switch (activityIndicatorViewStyle) {
701
- case UIActivityIndicatorViewStyleWhiteLarge:
702
- self.controlSize = NSControlSizeRegular;
701
+ case UIActivityIndicatorViewStyleLarge:
702
+ if (@available(macOS 11.0, *)) {
703
+ self.controlSize = NSControlSizeLarge;
704
+ } else {
705
+ self.controlSize = NSControlSizeRegular;
706
+ }
703
707
  break;
704
- case UIActivityIndicatorViewStyleWhite:
705
- self.controlSize = NSControlSizeSmall;
708
+ case UIActivityIndicatorViewStyleMedium:
709
+ self.controlSize = NSControlSizeRegular;
706
710
  break;
707
711
  default:
708
712
  break;
@@ -7,13 +7,6 @@
7
7
 
8
8
  #import <React/RCTBridge.h>
9
9
 
10
- #if TARGET_OS_OSX // [macOS RCTExportedDimensions is needed in RCTRootContentView
11
- #ifdef __cplusplus
12
- extern "C"
13
- #endif
14
- NSDictionary *RCTExportedDimensions(RCTPlatformView *rootView, RCTBridge *bridge);
15
- #endif // macOS]
16
-
17
10
  @interface RCTDeviceInfo : NSObject <RCTBridgeModule>
18
11
 
19
12
  @end