react-native-macos 0.73.10 → 0.73.11

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 (42) hide show
  1. package/Libraries/AppDelegate/RCTAppDelegate.mm +5 -1
  2. package/Libraries/Core/ReactNativeVersion.js +1 -1
  3. package/Libraries/Image/RCTUIImageViewAnimated.mm +0 -5
  4. package/Libraries/Network/React-RCTNetwork.podspec +4 -1
  5. package/Libraries/PushNotificationIOS/RCTPushNotificationManager.h +2 -2
  6. package/Libraries/PushNotificationIOS/RCTPushNotificationManager.mm +9 -111
  7. package/Libraries/Text/React-RCTText.podspec +4 -1
  8. package/Libraries/Text/Text/RCTTextView.mm +7 -15
  9. package/Libraries/Text/TextInput/RCTBaseTextInputView.mm +2 -6
  10. package/Libraries/Text/TextInput/Singleline/macOS/RCTUISecureTextField.h +3 -0
  11. package/Libraries/Text/TextInput/Singleline/macOS/RCTUISecureTextField.m +2 -0
  12. package/React/Base/RCTConvert.m +2 -0
  13. package/React/Base/RCTKeyCommands.m +5 -1
  14. package/React/Base/RCTUtils.h +5 -0
  15. package/React/Base/RCTUtils.m +12 -0
  16. package/React/Base/RCTVersion.m +1 -1
  17. package/React/CoreModules/RCTDeviceInfo.mm +9 -9
  18. package/React/CoreModules/RCTPerfMonitor.mm +5 -1
  19. package/React/CoreModules/RCTRedBox.mm +6 -0
  20. package/React/CoreModules/RCTStatusBarManager.mm +50 -15
  21. package/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryComponentView.mm +4 -0
  22. package/React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.mm +8 -0
  23. package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +6 -4
  24. package/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm +7 -15
  25. package/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm +3 -1
  26. package/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.mm +2 -2
  27. package/React/Fabric/RCTSurfacePointerHandler.mm +8 -1
  28. package/React/Fabric/RCTSurfaceTouchHandler.mm +4 -0
  29. package/React/Modules/RCTUIManager.m +4 -2
  30. package/React/React-RCTFabric.podspec +5 -2
  31. package/React/UIUtils/RCTUIUtils.m +21 -4
  32. package/React/Views/RCTModalHostView.m +2 -0
  33. package/React/Views/RCTModalHostViewController.m +8 -0
  34. package/React/Views/RCTWrapperViewController.m +2 -0
  35. package/React/Views/ScrollView/RCTScrollView.m +4 -0
  36. package/React/Views/ScrollView/RCTScrollViewManager.h +2 -0
  37. package/React/Views/ScrollView/RCTScrollViewManager.m +4 -2
  38. package/ReactAndroid/gradle.properties +1 -1
  39. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
  40. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  41. package/ReactCommon/react/nativemodule/samples/platform/ios/ReactCommon/RCTSampleTurboModule.mm +4 -0
  42. package/package.json +1 -1
@@ -129,7 +129,11 @@ static NSString *const kRNConcurrentRoot = @"concurrentRoot";
129
129
  rootView = [self createRootViewWithBridge:self.bridge moduleName:self.moduleName initProps:initProps];
130
130
  }
131
131
  #if !TARGET_OS_OSX // [macOS]
132
+ #if !TARGET_OS_VISION // [visionOS]
132
133
  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
134
+ #else
135
+ self.window = [[UIWindow alloc] initWithFrame:CGRectMake(0, 0, 1280, 720)];
136
+ #endif // [visionOS]
133
137
  UIViewController *rootViewController = [self createRootViewController];
134
138
  [self setRootView:rootView toRootViewController:rootViewController];
135
139
  self.window.rootViewController = rootViewController;
@@ -138,7 +142,7 @@ static NSString *const kRNConcurrentRoot = @"concurrentRoot";
138
142
 
139
143
  return YES;
140
144
  #else // [macOS
141
- NSRect frame = NSMakeRect(0,0,1024,768);
145
+ NSRect frame = NSMakeRect(0,0,1280,720);
142
146
  self.window = [[NSWindow alloc] initWithContentRect:NSZeroRect
143
147
  styleMask:NSWindowStyleMaskTitled | NSWindowStyleMaskResizable | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable
144
148
  backing:NSBackingStoreBuffered
@@ -12,6 +12,6 @@
12
12
  exports.version = {
13
13
  major: 0,
14
14
  minor: 73,
15
- patch: 10,
15
+ patch: 11,
16
16
  prerelease: null,
17
17
  };
@@ -193,15 +193,10 @@ static NSUInteger RCTDeviceFreeMemory(void)
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;
@@ -42,7 +42,10 @@ Pod::Spec.new do |s|
42
42
  "CLANG_CXX_LANGUAGE_STANDARD" => "c++20",
43
43
  "HEADER_SEARCH_PATHS" => header_search_paths.join(' ')
44
44
  }
45
- s.ios.frameworks = "MobileCoreServices" # [macOS] Restrict to iOS
45
+ # [macOS MobileCoreServices Not available on macOS
46
+ s.ios.frameworks = "MobileCoreServices"
47
+ s.visionos.frameworks = "MobileCoreServices"
48
+ # macOS]
46
49
 
47
50
  s.dependency "RCT-Folly", folly_version
48
51
  s.dependency "RCTTypeSafety"
@@ -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
  {
@@ -30,7 +30,10 @@ Pod::Spec.new do |s|
30
30
  s.ios.exclude_files = "**/macOS/*" # [macOS]
31
31
  s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs"
32
32
  s.header_dir = "RCTText"
33
- s.ios.framework = ["MobileCoreServices"] # [macOS] Restrict to iOS
33
+ # [macOS MobileCoreServices Not available on macOS
34
+ s.ios.frameworks = "MobileCoreServices"
35
+ s.visionos.frameworks = "MobileCoreServices"
36
+ # macOS]
34
37
  s.pod_target_xcconfig = { "CLANG_CXX_LANGUAGE_STANDARD" => "c++20" }
35
38
 
36
39
  s.dependency "Yoga"
@@ -373,29 +373,21 @@
373
373
 
374
374
  - (void)handleLongPress:(UILongPressGestureRecognizer *)gesture
375
375
  {
376
- #if !TARGET_OS_UIKITFORMAC
377
- if (@available(iOS 16.0, *)) {
376
+ if (@available(iOS 16.0, macCatalyst 16.0, *)) {
378
377
  CGPoint location = [gesture locationInView:self];
379
378
  UIEditMenuConfiguration *config = [UIEditMenuConfiguration configurationWithIdentifier:nil sourcePoint:location];
380
379
  if (_editMenuInteraction) {
381
380
  [_editMenuInteraction presentEditMenuWithConfiguration:config];
382
381
  }
383
- return;
384
- }
385
- // TODO: Adopt showMenuFromRect (necessary for UIKitForMac)
386
- UIMenuController *menuController = [UIMenuController sharedMenuController];
382
+ } else {
383
+ UIMenuController *menuController = [UIMenuController sharedMenuController];
387
384
 
388
- if (menuController.isMenuVisible) {
389
- return;
390
- }
385
+ if (menuController.isMenuVisible) {
386
+ return;
387
+ }
391
388
 
392
- if (!self.isFirstResponder) {
393
- [self becomeFirstResponder];
389
+ [menuController showMenuFromView:self rect:self.bounds];
394
390
  }
395
-
396
- [menuController setTargetRect:self.bounds inView:self];
397
- [menuController setMenuVisible:YES animated:YES];
398
- #endif
399
391
  }
400
392
  #else // [macOS
401
393
 
@@ -851,6 +851,7 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)decoder)
851
851
 
852
852
  #pragma mark - Custom Input Accessory View
853
853
 
854
+ #if TARGET_OS_IOS // [macOS] [visionOS]
854
855
  - (void)didSetProps:(NSArray<NSString *> *)changedProps
855
856
  {
856
857
  if ([changedProps containsObject:@"inputAccessoryViewID"] && self.inputAccessoryViewID) {
@@ -862,7 +863,6 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)decoder)
862
863
 
863
864
  - (void)setCustomInputAccessoryViewWithNativeID:(NSString *)nativeID
864
865
  {
865
- #if !TARGET_OS_OSX // [macOS]
866
866
  __weak RCTBaseTextInputView *weakSelf = self;
867
867
  [_bridge.uiManager rootViewForReactTag:self.reactTag
868
868
  withCompletion:^(UIView *rootView) {
@@ -877,12 +877,10 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)decoder)
877
877
  }
878
878
  }
879
879
  }];
880
- #endif // [macOS]
881
880
  }
882
881
 
883
882
  - (void)setDefaultInputAccessoryView
884
883
  {
885
- #if !TARGET_OS_OSX // [macOS]
886
884
  UIView<RCTBackedTextInputViewProtocol> *textInputView = self.backedTextInputView;
887
885
  UIKeyboardType keyboardType = textInputView.keyboardType;
888
886
 
@@ -914,10 +912,8 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)decoder)
914
912
  textInputView.inputAccessoryView = nil;
915
913
  }
916
914
  [self reloadInputViewsIfNecessary];
917
- #endif // [macOS]
918
915
  }
919
916
 
920
- #if !TARGET_OS_OSX // [macOS]
921
917
  - (void)reloadInputViewsIfNecessary
922
918
  {
923
919
  // We have to call `reloadInputViews` for focused text inputs to update an accessory view.
@@ -934,7 +930,7 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)decoder)
934
930
  [self.backedTextInputView endEditing:YES];
935
931
  }
936
932
  }
937
- #endif // [macOS]
933
+ #endif // [macOS] [visionOS]
938
934
 
939
935
  // [macOS
940
936
 
@@ -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.mm"
@@ -555,8 +555,10 @@ RCT_ENUM_CONVERTER(
555
555
  (@{
556
556
  @"default" : @(UIBarStyleDefault),
557
557
  @"black" : @(UIBarStyleBlack),
558
+ #if !TARGET_OS_VISION // [visionOS]
558
559
  @"blackOpaque" : @(UIBarStyleBlackOpaque),
559
560
  @"blackTranslucent" : @(UIBarStyleBlackTranslucent),
561
+ #endif // [visionOS]
560
562
  }),
561
563
  UIBarStyleDefault,
562
564
  integerValue)
@@ -129,7 +129,11 @@ RCT_NOT_IMPLEMENTED(-(instancetype)init)
129
129
  isKeyDown = [event _isKeyDown];
130
130
  }
131
131
 
132
- BOOL interactionEnabled = !RCTSharedApplication().isIgnoringInteractionEvents;
132
+ #if !TARGET_OS_VISION // [visionOS]
133
+ BOOL interactionEnabled = !RCTSharedApplication().isIgnoringInteractionEvents;
134
+ #else // [visionOS
135
+ BOOL interactionEnabled = true;
136
+ #endif // visionOS]
133
137
  BOOL hasFirstResponder = NO;
134
138
  if (isKeyDown && modifiedInput.length > 0 && interactionEnabled) {
135
139
  UIResponder *firstResponder = nil;
@@ -99,6 +99,11 @@ RCT_EXTERN RCTUIApplication *__nullable RCTSharedApplication(void); // [macOS]
99
99
  // or view controller
100
100
  RCT_EXTERN RCTUIWindow *__nullable RCTKeyWindow(void); // [macOS]
101
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]
106
+
102
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
@@ -352,7 +352,11 @@ CGSize RCTScreenSize(void)
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
 
@@ -620,6 +624,14 @@ RCTUIWindow *__nullable RCTKeyWindow(void) // [macOS]
620
624
  #endif // macOS]
621
625
  }
622
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
+
623
635
  #if !TARGET_OS_OSX // [macOS]
624
636
  UIViewController *__nullable RCTPresentedViewController(void)
625
637
  {
@@ -23,7 +23,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
23
23
  __rnVersion = @{
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(73),
26
- RCTVersionPatch: @(10),
26
+ RCTVersionPatch: @(11),
27
27
  RCTVersionPrerelease: [NSNull null],
28
28
  };
29
29
  });
@@ -56,27 +56,30 @@ RCT_EXPORT_MODULE()
56
56
  name:RCTAccessibilityManagerDidUpdateMultiplierNotification
57
57
  object:[_moduleRegistry moduleForName:"AccessibilityManager"]];
58
58
 
59
+ #if TARGET_OS_IOS // [visionOS]
59
60
  _currentInterfaceOrientation = [RCTSharedApplication() statusBarOrientation];
60
61
 
61
62
  [[NSNotificationCenter defaultCenter] addObserver:self
62
63
  selector:@selector(interfaceOrientationDidChange)
63
64
  name:UIApplicationDidChangeStatusBarOrientationNotification
64
65
  object:nil];
66
+ #endif // [visionOS]
65
67
  #endif // [macOS]
66
68
 
67
69
  _currentInterfaceDimensions = [self _exportedDimensions];
68
70
 
69
- #if !TARGET_OS_OSX // [macOS]
71
+ #if TARGET_OS_IOS // [macOS] [visionOS]
70
72
  [[NSNotificationCenter defaultCenter] addObserver:self
71
73
  selector:@selector(interfaceOrientationDidChange)
72
74
  name:UIApplicationDidBecomeActiveNotification
73
75
  object:nil];
76
+ #endif // [macOS] [visionOS]
74
77
 
75
78
  [[NSNotificationCenter defaultCenter] addObserver:self
76
79
  selector:@selector(interfaceFrameDidChange)
77
80
  name:RCTUserInterfaceStyleDidChangeNotification
78
81
  object:nil];
79
- #endif // [macOS]
82
+
80
83
  [[NSNotificationCenter defaultCenter] addObserver:self
81
84
  selector:@selector(interfaceFrameDidChange)
82
85
  name:RCTWindowFrameDidChangeNotification
@@ -90,8 +93,8 @@ RCT_EXPORT_MODULE()
90
93
 
91
94
  static BOOL RCTIsIPhoneNotched()
92
95
  {
93
- #if !TARGET_OS_OSX // [macOS]
94
96
  static BOOL isIPhoneNotched = NO;
97
+ #if TARGET_OS_IOS // [macOS] [visionOS]
95
98
  static dispatch_once_t onceToken;
96
99
 
97
100
  dispatch_once(&onceToken, ^{
@@ -100,11 +103,9 @@ static BOOL RCTIsIPhoneNotched()
100
103
  // 20pt is the top safeArea value in non-notched devices
101
104
  isIPhoneNotched = RCTSharedApplication().keyWindow.safeAreaInsets.top > 20;
102
105
  });
106
+ #endif // [macOS] [visionOS]
103
107
 
104
108
  return isIPhoneNotched;
105
- #else // [macOS
106
- return NO;
107
- #endif // macOS]
108
109
  }
109
110
 
110
111
 
@@ -182,8 +183,7 @@ static NSDictionary *RCTExportedDimensions(CGFloat fontScale)
182
183
  });
183
184
  }
184
185
 
185
- #if !TARGET_OS_OSX // [macOS]
186
-
186
+ #if TARGET_OS_IOS // [macOS] [visionOS]
187
187
  - (void)interfaceOrientationDidChange
188
188
  {
189
189
  __weak __typeof(self) weakSelf = self;
@@ -224,7 +224,7 @@ static NSDictionary *RCTExportedDimensions(CGFloat fontScale)
224
224
  #pragma clang diagnostic pop
225
225
  }
226
226
  }
227
- #endif // [macOS]
227
+ #endif // [macOS] [visionOS]
228
228
 
229
229
  - (void)interfaceFrameDidChange
230
230
  {
@@ -183,7 +183,11 @@ RCT_EXPORT_MODULE()
183
183
  - (UIView *)container
184
184
  {
185
185
  if (!_container) {
186
- CGSize statusBarSize = RCTSharedApplication().statusBarFrame.size;
186
+ #if !TARGET_OS_VISION // [visionOS]
187
+ CGSize statusBarSize = RCTSharedApplication().statusBarFrame.size;
188
+ #else // [visionOS
189
+ CGSize statusBarSize = RCTUIStatusBarManager().statusBarFrame.size;
190
+ #endif // visionOS]
187
191
  CGFloat statusBarHeight = statusBarSize.height;
188
192
  _container = [[UIView alloc] initWithFrame:CGRectMake(10, statusBarHeight, 180, RCTPerfMonitorBarHeight)];
189
193
  _container.layer.borderWidth = 2;
@@ -953,9 +953,15 @@ RCT_EXPORT_MODULE()
953
953
 
954
954
  if (!self->_window) {
955
955
  #if !TARGET_OS_OSX // [macOS]
956
+ #if !TARGET_OS_VISION // [macOS]
956
957
  self->_window = [[RCTRedBoxWindow alloc] initWithFrame:[UIScreen mainScreen].bounds
957
958
  customButtonTitles:self->_customButtonTitles
958
959
  customButtonHandlers:self->_customButtonHandlers];
960
+ #else // [visionOS
961
+ self->_window = [[RCTRedBoxWindow alloc] initWithFrame:CGRectMake(0, 0, 1280, 720)
962
+ customButtonTitles:self->_customButtonTitles
963
+ customButtonHandlers:self->_customButtonHandlers];
964
+ #endif // visionOS]
959
965
  #else // [macOS
960
966
  self->_window = [RCTRedBoxWindow new];
961
967
  #endif // macOS]
@@ -12,9 +12,9 @@
12
12
  #import <React/RCTLog.h>
13
13
  #import <React/RCTUtils.h>
14
14
 
15
- #if !TARGET_OS_OSX // [macOS]
16
15
  #import <FBReactNativeSpec/FBReactNativeSpec.h>
17
16
 
17
+ #if !TARGET_OS_OSX // [macOS]
18
18
  @implementation RCTConvert (UIStatusBar)
19
19
 
20
20
  + (UIStatusBarStyle)UIStatusBarStyle:(id)json RCT_DYNAMIC
@@ -44,14 +44,14 @@ RCT_ENUM_CONVERTER(
44
44
  integerValue);
45
45
 
46
46
  @end
47
+ #endif // [macOS]
47
48
 
48
49
  @interface RCTStatusBarManager () <NativeStatusBarManagerIOSSpec>
49
50
  @end
50
51
 
51
- #endif // [macOS]
52
-
53
52
  @implementation RCTStatusBarManager
54
53
 
54
+ #if !TARGET_OS_OSX // [macOS]
55
55
  static BOOL RCTViewControllerBasedStatusBarAppearance()
56
56
  {
57
57
  static BOOL value;
@@ -64,6 +64,7 @@ static BOOL RCTViewControllerBasedStatusBarAppearance()
64
64
 
65
65
  return value;
66
66
  }
67
+ #endif // [macOS]
67
68
 
68
69
  RCT_EXPORT_MODULE()
69
70
 
@@ -72,15 +73,15 @@ RCT_EXPORT_MODULE()
72
73
  return YES;
73
74
  }
74
75
 
76
+ #if TARGET_OS_OSX // [macOS]
75
77
  - (NSArray<NSString *> *)supportedEvents
76
78
  {
77
79
  return @[ @"statusBarFrameDidChange", @"statusBarFrameWillChange" ];
78
80
  }
79
81
 
80
- #if !TARGET_OS_OSX // [macOS]
81
-
82
82
  - (void)startObserving
83
83
  {
84
+ #if TARGET_OS_IOS // [visionOS]
84
85
  NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
85
86
  [nc addObserver:self
86
87
  selector:@selector(applicationDidChangeStatusBarFrame:)
@@ -90,6 +91,7 @@ RCT_EXPORT_MODULE()
90
91
  selector:@selector(applicationWillChangeStatusBarFrame:)
91
92
  name:UIApplicationWillChangeStatusBarFrameNotification
92
93
  object:nil];
94
+ #endif // [visionOS]
93
95
  }
94
96
 
95
97
  - (void)stopObserving
@@ -104,6 +106,7 @@ RCT_EXPORT_MODULE()
104
106
 
105
107
  - (void)emitEvent:(NSString *)eventName forNotification:(NSNotification *)notification
106
108
  {
109
+ #if TARGET_OS_IOS // [visionOS]
107
110
  CGRect frame = [notification.userInfo[UIApplicationStatusBarFrameUserInfoKey] CGRectValue];
108
111
  NSDictionary *event = @{
109
112
  @"frame" : @{
@@ -114,6 +117,7 @@ RCT_EXPORT_MODULE()
114
117
  },
115
118
  };
116
119
  [self sendEventWithName:eventName body:event];
120
+ #endif // [visionOS]
117
121
  }
118
122
 
119
123
  - (void)applicationDidChangeStatusBarFrame:(NSNotification *)notification
@@ -125,19 +129,34 @@ RCT_EXPORT_MODULE()
125
129
  {
126
130
  [self emitEvent:@"statusBarFrameWillChange" forNotification:notification];
127
131
  }
132
+ #endif
128
133
 
129
134
  RCT_EXPORT_METHOD(getHeight : (RCTResponseSenderBlock)callback)
130
135
  {
136
+ #if !TARGET_OS_OSX // [macOS]
137
+ #if !TARGET_OS_VISION // [visionOS]
131
138
  callback(@[ @{
132
139
  @"height" : @(RCTSharedApplication().statusBarFrame.size.height),
133
140
  } ]);
141
+ #else // [visionOS
142
+ callback(@[ @{
143
+ @"height" : @(RCTUIStatusBarManager().statusBarFrame.size),
144
+ } ]);
145
+ #endif // visionOS]
146
+ #else // [macOS
147
+ callback(@[ @{
148
+ @"height" : @(0),
149
+ } ]);
150
+ #endif // macOS]
134
151
  }
135
152
 
136
153
  RCT_EXPORT_METHOD(setStyle : (NSString *)style animated : (BOOL)animated)
137
154
  {
138
- UIStatusBarStyle statusBarStyle = [RCTConvert UIStatusBarStyle:style];
139
- if (RCTViewControllerBasedStatusBarAppearance()) {
140
- RCTLogError(@"RCTStatusBarManager module requires that the \
155
+ #if TARGET_OS_IOS // [macOS] [visionOS]
156
+ dispatch_async(dispatch_get_main_queue(), ^{
157
+ UIStatusBarStyle statusBarStyle = [RCTConvert UIStatusBarStyle:style];
158
+ if (RCTViewControllerBasedStatusBarAppearance()) {
159
+ RCTLogError(@"RCTStatusBarManager module requires that the \
141
160
  UIViewControllerBasedStatusBarAppearance key in the Info.plist is set to NO");
142
161
  } else {
143
162
  #pragma clang diagnostic push
@@ -145,25 +164,35 @@ RCT_EXPORT_METHOD(setStyle : (NSString *)style animated : (BOOL)animated)
145
164
  [RCTSharedApplication() setStatusBarStyle:statusBarStyle animated:animated];
146
165
  }
147
166
  #pragma clang diagnostic pop
167
+ });
168
+ #endif // [macOS] [visionOS]
148
169
  }
149
170
 
150
171
  RCT_EXPORT_METHOD(setHidden : (BOOL)hidden withAnimation : (NSString *)withAnimation)
151
172
  {
152
- UIStatusBarAnimation animation = [RCTConvert UIStatusBarAnimation:withAnimation];
153
- if (RCTViewControllerBasedStatusBarAppearance()) {
154
- RCTLogError(@"RCTStatusBarManager module requires that the \
173
+ #if TARGET_OS_IOS // [macOS] [visionOS]
174
+ dispatch_async(dispatch_get_main_queue(), ^{
175
+ UIStatusBarAnimation animation = [RCTConvert UIStatusBarAnimation:withAnimation];
176
+ if (RCTViewControllerBasedStatusBarAppearance()) {
177
+ RCTLogError(@"RCTStatusBarManager module requires that the \
155
178
  UIViewControllerBasedStatusBarAppearance key in the Info.plist is set to NO");
156
179
  } else {
157
180
  #pragma clang diagnostic push
158
181
  #pragma clang diagnostic ignored "-Wdeprecated-declarations"
159
182
  [RCTSharedApplication() setStatusBarHidden:hidden withAnimation:animation];
160
183
  #pragma clang diagnostic pop
161
- }
184
+ }
185
+ });
186
+ #endif // [macOS] [visionOS]
162
187
  }
163
188
 
164
189
  RCT_EXPORT_METHOD(setNetworkActivityIndicatorVisible : (BOOL)visible)
165
190
  {
166
- RCTSharedApplication().networkActivityIndicatorVisible = visible;
191
+ #if TARGET_OS_IOS // [visionOS]
192
+ dispatch_async(dispatch_get_main_queue(), ^{
193
+ RCTSharedApplication().networkActivityIndicatorVisible = visible;
194
+ });
195
+ #endif // [visionOS]
167
196
  }
168
197
 
169
198
  - (facebook::react::ModuleConstants<JS::NativeStatusBarManagerIOS::Constants>)getConstants
@@ -171,7 +200,15 @@ RCT_EXPORT_METHOD(setNetworkActivityIndicatorVisible : (BOOL)visible)
171
200
  __block facebook::react::ModuleConstants<JS::NativeStatusBarManagerIOS::Constants> constants;
172
201
  RCTUnsafeExecuteOnMainQueueSync(^{
173
202
  constants = facebook::react::typedConstants<JS::NativeStatusBarManagerIOS::Constants>({
203
+ #if !TARGET_OS_OSX // [macOS]
204
+ #if !TARGET_OS_VISION // [visionOS]
174
205
  .HEIGHT = RCTSharedApplication().statusBarFrame.size.height,
206
+ #else // [visionOS
207
+ .HEIGHT = RCTUIStatusBarManager().statusBarFrame.size.height,
208
+ #endif // visionOS]
209
+ #else // [macOS
210
+ .HEIGHT = 0,
211
+ #endif // macOS]
175
212
  .DEFAULT_BACKGROUND_COLOR = std::nullopt,
176
213
  });
177
214
  });
@@ -190,8 +227,6 @@ RCT_EXPORT_METHOD(setNetworkActivityIndicatorVisible : (BOOL)visible)
190
227
  return std::make_shared<facebook::react::NativeStatusBarManagerIOSSpecJSI>(params);
191
228
  }
192
229
 
193
- #endif // [macOS]
194
-
195
230
  @end
196
231
 
197
232
  Class RCTStatusBarManagerCls(void)
@@ -68,7 +68,9 @@ static RCTUIView<RCTBackedTextInputViewProtocol> *_Nullable RCTFindTextInputWith
68
68
  if (self.nativeId) {
69
69
  #if !TARGET_OS_OSX // [macOS]
70
70
  _textInput = RCTFindTextInputWithNativeId(self.window, self.nativeId);
71
+ #if !TARGET_OS_VISION // [visionOS]
71
72
  _textInput.inputAccessoryView = _contentView;
73
+ #endif // [visionOS]
72
74
  #else // [macOS
73
75
  _textInput = RCTFindTextInputWithNativeId(self.window.contentView, self.nativeId);
74
76
  #endif // macOS]
@@ -87,10 +89,12 @@ static RCTUIView<RCTBackedTextInputViewProtocol> *_Nullable RCTFindTextInputWith
87
89
  return true;
88
90
  }
89
91
 
92
+ #if !TARGET_OS_VISION // [visionOS]
90
93
  - (RCTUIView *)inputAccessoryView // [macOS]
91
94
  {
92
95
  return _contentView;
93
96
  }
97
+ #endif // [visionOS]
94
98
 
95
99
  #pragma mark - RCTComponentViewProtocol
96
100
 
@@ -43,10 +43,12 @@
43
43
  [_touchHandler attachToView:self.view];
44
44
  }
45
45
 
46
+ #if TARGET_OS_IOS // [visionOS]
46
47
  - (UIStatusBarStyle)preferredStatusBarStyle
47
48
  {
48
49
  return [RCTSharedApplication() statusBarStyle];
49
50
  }
51
+ #endif // [visionOS]
50
52
 
51
53
  - (void)viewDidDisappear:(BOOL)animated
52
54
  {
@@ -54,16 +56,22 @@
54
56
  _lastViewBounds = CGRectZero;
55
57
  }
56
58
 
59
+ #if TARGET_OS_IOS // [visionOS]
57
60
  - (BOOL)prefersStatusBarHidden
58
61
  {
59
62
  return [RCTSharedApplication() isStatusBarHidden];
60
63
  }
64
+ #endif // [visionOS]
61
65
 
62
66
  #if RCT_DEV
63
67
  - (UIInterfaceOrientationMask)supportedInterfaceOrientations
64
68
  {
69
+ #if !TARGET_OS_VISION // [visionOS]
65
70
  UIInterfaceOrientationMask appSupportedOrientationsMask =
66
71
  [RCTSharedApplication() supportedInterfaceOrientationsForWindow:[RCTSharedApplication() keyWindow]];
72
+ #else // [visionOS
73
+ UIInterfaceOrientationMask appSupportedOrientationsMask = UIInterfaceOrientationMaskLandscape;
74
+ #endif // visonOS]
67
75
  if (!(_supportedInterfaceOrientations & appSupportedOrientationsMask)) {
68
76
  RCTLogError(
69
77
  @"Modal was presented with 0x%x orientations mask but the application only supports 0x%x."
@@ -28,7 +28,7 @@ using namespace facebook::react;
28
28
 
29
29
  static const CGFloat kClippingLeeway = 44.0;
30
30
 
31
- #if !TARGET_OS_OSX // [macOS]
31
+ #if TARGET_OS_IOS // [macOS] [visionOS]
32
32
  static UIScrollViewKeyboardDismissMode RCTUIKeyboardDismissModeFromProps(const ScrollViewProps &props)
33
33
  {
34
34
  switch (props.keyboardDismissMode) {
@@ -40,7 +40,9 @@ static UIScrollViewKeyboardDismissMode RCTUIKeyboardDismissModeFromProps(const S
40
40
  return UIScrollViewKeyboardDismissModeInteractive;
41
41
  }
42
42
  }
43
+ #endif // [macOS] [visionOS]
43
44
 
45
+ #if !TARGET_OS_OSX // [macOS
44
46
  static UIScrollViewIndicatorStyle RCTUIScrollViewIndicatorStyleFromProps(const ScrollViewProps &props)
45
47
  {
46
48
  switch (props.indicatorStyle) {
@@ -52,6 +54,7 @@ static UIScrollViewIndicatorStyle RCTUIScrollViewIndicatorStyleFromProps(const S
52
54
  return UIScrollViewIndicatorStyleWhite;
53
55
  }
54
56
  }
57
+ #endif // [macOS]
55
58
 
56
59
  // Once Fabric implements proper NativeAnimationDriver, this should be removed.
57
60
  // This is just a workaround to allow animations based on onScroll event.
@@ -79,7 +82,6 @@ static void RCTSendScrollEventForNativeAnimations_DEPRECATED(RCTUIScrollView *sc
79
82
  userInfo:userInfo];
80
83
  }
81
84
  }
82
- #endif // [macOS]
83
85
 
84
86
  @interface RCTScrollViewComponentView () <
85
87
  #if !TARGET_OS_OSX // [macOS]
@@ -329,9 +331,9 @@ static void RCTSendScrollEventForNativeAnimations_DEPRECATED(RCTUIScrollView *sc
329
331
  MAP_SCROLL_VIEW_PROP(snapToInterval);
330
332
 
331
333
  if (oldScrollViewProps.keyboardDismissMode != newScrollViewProps.keyboardDismissMode) {
332
- #if !TARGET_OS_OSX // [macOS]
334
+ #if TARGET_OS_IOS // [macOS] [visionOS]
333
335
  scrollView.keyboardDismissMode = RCTUIKeyboardDismissModeFromProps(newScrollViewProps);
334
- #endif // [macOS]
336
+ #endif // [macOS] [visionOS]
335
337
  }
336
338
 
337
339
  [super updateProps:props oldProps:oldProps];
@@ -251,29 +251,21 @@ using namespace facebook::react;
251
251
 
252
252
  - (void)handleLongPress:(UILongPressGestureRecognizer *)gesture
253
253
  {
254
- #if !TARGET_OS_UIKITFORMAC
255
- if (@available(iOS 16.0, *)) {
254
+ if (@available(iOS 16.0, macCatalyst 16.0, *)) {
256
255
  CGPoint location = [gesture locationInView:self];
257
256
  UIEditMenuConfiguration *config = [UIEditMenuConfiguration configurationWithIdentifier:nil sourcePoint:location];
258
257
  if (_editMenuInteraction) {
259
258
  [_editMenuInteraction presentEditMenuWithConfiguration:config];
260
259
  }
261
- return;
262
- }
263
- // TODO: Adopt showMenuFromRect (necessary for UIKitForMac)
264
- UIMenuController *menuController = [UIMenuController sharedMenuController];
260
+ } else {
261
+ UIMenuController *menuController = [UIMenuController sharedMenuController];
265
262
 
266
- if (menuController.isMenuVisible) {
267
- return;
268
- }
263
+ if (menuController.isMenuVisible) {
264
+ return;
265
+ }
269
266
 
270
- if (!self.isFirstResponder) {
271
- [self becomeFirstResponder];
267
+ [menuController showMenuFromView:self rect:self.bounds];
272
268
  }
273
-
274
- [menuController setTargetRect:self.bounds inView:self];
275
- [menuController setMenuVisible:YES animated:YES];
276
- #endif
277
269
  }
278
270
  #endif // [macOS]
279
271
 
@@ -563,6 +563,7 @@ using namespace facebook::react;
563
563
  keyboardType == UIKeyboardTypeDecimalPad || keyboardType == UIKeyboardTypeASCIICapableNumberPad) &&
564
564
  _backedTextInputView.returnKeyType == UIReturnKeyDone;
565
565
 
566
+ #if !TARGET_OS_VISION // [visionOS]
566
567
  if ((_backedTextInputView.inputAccessoryView != nil) == shouldHaveInputAccessoryView) {
567
568
  return;
568
569
  }
@@ -581,7 +582,8 @@ using namespace facebook::react;
581
582
  } else {
582
583
  _backedTextInputView.inputAccessoryView = nil;
583
584
  }
584
-
585
+ #endif // [visionOS]
586
+
585
587
  if (_backedTextInputView.isFirstResponder) {
586
588
  [_backedTextInputView reloadInputViews];
587
589
  }
@@ -32,9 +32,9 @@ void RCTCopyBackedTextInput(
32
32
  toTextInput.placeholder = fromTextInput.placeholder;
33
33
  toTextInput.placeholderColor = fromTextInput.placeholderColor;
34
34
  toTextInput.textContainerInset = fromTextInput.textContainerInset;
35
- #if !TARGET_OS_OSX // [macOS]
35
+ #if TARGET_OS_IOS // [macOS] [visionOS]
36
36
  toTextInput.inputAccessoryView = fromTextInput.inputAccessoryView;
37
- #endif // [macOS]
37
+ #endif // [macOS] [visionOS]
38
38
  toTextInput.textInputDelegate = fromTextInput.textInputDelegate;
39
39
  toTextInput.placeholderColor = fromTextInput.placeholderColor;
40
40
  toTextInput.defaultTextAttributes = fromTextInput.defaultTextAttributes;
@@ -291,9 +291,11 @@ static PointerEvent CreatePointerEventFromActivePointer(
291
291
 
292
292
  if (eventType == RCTPointerEventTypeCancel) {
293
293
  event.clientPoint = RCTPointFromCGPoint(CGPointZero);
294
+ #if !TARGET_OS_VISION // [visionOS]
294
295
  event.screenPoint =
295
296
  RCTPointFromCGPoint([rootComponentView convertPoint:CGPointZero
296
297
  toCoordinateSpace:rootComponentView.window.screen.coordinateSpace]);
298
+ #endif // [visionOS]
297
299
  event.offsetPoint = RCTPointFromCGPoint([rootComponentView convertPoint:CGPointZero
298
300
  toView:activePointer.componentView]);
299
301
  } else {
@@ -386,8 +388,10 @@ static void UpdateActivePointerWithUITouch(
386
388
 
387
389
  #if !TARGET_OS_OSX // [macOS]
388
390
  activePointer.clientPoint = [uiTouch locationInView:rootComponentView];
391
+ #if !TARGET_OS_VISION // [visionOS]
389
392
  activePointer.screenPoint = [rootComponentView convertPoint:activePointer.clientPoint
390
393
  toCoordinateSpace:rootComponentView.window.screen.coordinateSpace];
394
+ #endif // [visionOS]
391
395
  activePointer.offsetPoint = [uiTouch locationInView:activePointer.componentView];
392
396
  #else // [macOS
393
397
  activePointer.offsetPoint = [activePointer.componentView convertPoint:uiTouch.locationInWindow fromView:nil];
@@ -910,9 +914,12 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithTarget : (id)target action : (SEL)act
910
914
  {
911
915
  UIView *listenerView = recognizer.view;
912
916
  CGPoint clientLocation = [recognizer locationInView:listenerView];
917
+ #if !TARGET_OS_VISION // [visionOS]
913
918
  CGPoint screenLocation = [listenerView convertPoint:clientLocation
914
919
  toCoordinateSpace:listenerView.window.screen.coordinateSpace];
915
-
920
+ #else // [visionOS
921
+ CGPoint screenLocation = CGPointZero;
922
+ #endif // visionOS]
916
923
  UIView *targetView = [listenerView hitTest:clientLocation withEvent:nil];
917
924
  targetView = FindClosestFabricManagedTouchableView(targetView);
918
925
 
@@ -58,8 +58,12 @@ static void UpdateActiveTouchWithUITouch(
58
58
  #if !TARGET_OS_OSX // [macOS]
59
59
  CGPoint offsetPoint = [uiTouch locationInView:activeTouch.componentView];
60
60
  CGPoint pagePoint = [uiTouch locationInView:rootComponentView];
61
+ #if !TARGET_OS_VISION // [visionOS]
61
62
  CGPoint screenPoint = [rootComponentView convertPoint:pagePoint
62
63
  toCoordinateSpace:rootComponentView.window.screen.coordinateSpace];
64
+ #else // [visionOS
65
+ CGPoint screenPoint = CGPointZero;
66
+ #endif // visionOS]
63
67
  pagePoint = CGPointMake(pagePoint.x + rootViewOriginOffset.x, pagePoint.y + rootViewOriginOffset.y);
64
68
  #else // [macOS
65
69
  CGPoint offsetPoint = [activeTouch.componentView convertPoint:uiTouch.locationInWindow fromView:nil];
@@ -198,10 +198,12 @@ RCT_EXPORT_MODULE()
198
198
  object:[self->_bridge moduleForName:@"AccessibilityManager"
199
199
  lazilyLoadIfNecessary:YES]];
200
200
  });
201
+ #if TARGET_OS_IOS // [visionOS]
201
202
  [[NSNotificationCenter defaultCenter] addObserver:self
202
203
  selector:@selector(namedOrientationDidChange)
203
204
  name:UIDeviceOrientationDidChangeNotification
204
205
  object:nil];
206
+ #endif // [visionOS]
205
207
  [RCTLayoutAnimation initializeStatics];
206
208
  #endif // [macOS]
207
209
  }
@@ -231,7 +233,7 @@ RCT_EXPORT_MODULE()
231
233
  }
232
234
  #endif // [macOS]
233
235
 
234
- #if !TARGET_OS_OSX // [macOS]
236
+ #if TARGET_OS_IOS // [macOS] [visionOS]
235
237
  // Names and coordinate system from html5 spec:
236
238
  // https://developer.mozilla.org/en-US/docs/Web/API/Screen.orientation
237
239
  // https://developer.mozilla.org/en-US/docs/Web/API/Screen.lockOrientation
@@ -284,7 +286,7 @@ static NSDictionary *deviceOrientationEventBody(UIDeviceOrientation orientation)
284
286
  body:orientationEvent];
285
287
  #pragma clang diagnostic pop
286
288
  }
287
- #endif // macOS]
289
+ #endif // [macOS] [visionOS]
288
290
 
289
291
  - (dispatch_queue_t)methodQueue
290
292
  {
@@ -55,8 +55,11 @@ Pod::Spec.new do |s|
55
55
  s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags
56
56
  s.header_dir = header_dir
57
57
  s.module_name = module_name
58
- s.ios.framework = ["JavaScriptCore", "MobileCoreServices"] # [macOS] Restrict MobileCoreServices to iOS
59
- s.osx.framework = ["JavaScriptCore"] # [macOS] Restrict MobileCoreServices to iOS
58
+ # [macOS MobileCoreServices not available on macOS
59
+ s.ios.framework = ["JavaScriptCore", "MobileCoreServices"]
60
+ s.visionos.framework = ["JavaScriptCore", "MobileCoreServices"]
61
+ s.osx.framework = ["JavaScriptCore"]
62
+ # macOS]
60
63
  s.pod_target_xcconfig = {
61
64
  "HEADER_SEARCH_PATHS" => header_search_paths,
62
65
  "OTHER_CFLAGS" => "$(inherited) -DRN_FABRIC_ENABLED" + " " + folly_flags,
@@ -12,24 +12,41 @@
12
12
  RCTDimensions RCTGetDimensions(CGFloat fontScale)
13
13
  {
14
14
  #if !TARGET_OS_OSX // [macOS]
15
+ #if !TARGET_OS_VISION // [visionOS]
15
16
  UIScreen *mainScreen = UIScreen.mainScreen;
16
17
  CGSize screenSize = mainScreen.bounds.size;
18
+ #else
19
+ CGSize screenSize = CGSizeZero;
20
+ #endif
21
+ #else // [macOS
22
+ NSScreen *mainScreen = NSScreen.mainScreen;
23
+ CGSize screenSize = mainScreen.frame.size;
24
+ #endif // macOS]
17
25
 
26
+ #if !TARGET_OS_OSX // [macOS]
18
27
  UIView *mainWindow = RCTKeyWindow();
19
28
  // We fallback to screen size if a key window is not found.
20
29
  CGSize windowSize = mainWindow ? mainWindow.bounds.size : screenSize;
21
30
  #else // [macOS
22
- RCTUIWindow *window = RCTKeyWindow();
23
- NSSize windowSize = window ? [window frame].size : CGSizeMake(0, 0);
24
- NSSize screenSize = window ? [[window screen] frame].size : CGSizeMake(0, 0);
31
+ NSWindow *window = RCTKeyWindow();
32
+ NSSize windowSize = window ? [window frame].size : CGSizeZero;
33
+ screenSize = window ? [[window screen] frame].size : screenSize;
25
34
  CGFloat scale = window ? [[window screen] backingScaleFactor] : 1.0; // Default scale to 1.0 if window is nil
26
- #endif // macOS
35
+ #endif // macOS]
36
+
27
37
  RCTDimensions result;
28
38
  #if !TARGET_OS_OSX // [macOS]
39
+ #if !TARGET_OS_VISION // [visionOS]
29
40
  typeof(result.screen) dimsScreen = {
30
41
  .width = screenSize.width, .height = screenSize.height, .scale = mainScreen.scale, .fontScale = fontScale};
31
42
  typeof(result.window) dimsWindow = {
32
43
  .width = windowSize.width, .height = windowSize.height, .scale = mainScreen.scale, .fontScale = fontScale};
44
+ #else // [visionOS hardcode the scale to a dummy value of 2
45
+ typeof(result.screen) dimsScreen = {
46
+ .width = screenSize.width, .height = screenSize.height, .scale = 2, .fontScale = fontScale};
47
+ typeof(result.window) dimsWindow = {
48
+ .width = windowSize.width, .height = windowSize.height, .scale = 2, .fontScale = fontScale};
49
+ #endif // visionOS]
33
50
  #else // [macOS
34
51
  typeof(result.screen) dimsScreen = {
35
52
  .width = screenSize.width,
@@ -73,6 +73,7 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : coder)
73
73
 
74
74
  - (void)notifyForOrientationChange
75
75
  {
76
+ #if TARGET_OS_IOS // [visionOS]
76
77
  if (!_onOrientationChange) {
77
78
  return;
78
79
  }
@@ -89,6 +90,7 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : coder)
89
90
  @"orientation" : isPortrait ? @"portrait" : @"landscape",
90
91
  };
91
92
  _onOrientationChange(eventPayload);
93
+ #endif // [visionOS]
92
94
  }
93
95
 
94
96
  - (void)insertReactSubview:(UIView *)subview atIndex:(NSInteger)atIndex
@@ -25,8 +25,10 @@
25
25
 
26
26
  self.modalInPresentation = YES;
27
27
 
28
+ #if TARGET_OS_IOS // [visionOS]
28
29
  _preferredStatusBarStyle = [RCTSharedApplication() statusBarStyle];
29
30
  _preferredStatusBarHidden = [RCTSharedApplication() isStatusBarHidden];
31
+ #endif // [visionOS]
30
32
 
31
33
  return self;
32
34
  }
@@ -41,6 +43,7 @@
41
43
  }
42
44
  }
43
45
 
46
+ #if TARGET_OS_IOS // [visionOS]
44
47
  - (UIStatusBarStyle)preferredStatusBarStyle
45
48
  {
46
49
  return _preferredStatusBarStyle;
@@ -50,12 +53,17 @@
50
53
  {
51
54
  return _preferredStatusBarHidden;
52
55
  }
56
+ #endif // [visionOS]
53
57
 
54
58
  #if RCT_DEV
55
59
  - (UIInterfaceOrientationMask)supportedInterfaceOrientations
56
60
  {
61
+ #if !TARGET_OS_VISION // [visionOS]
57
62
  UIInterfaceOrientationMask appSupportedOrientationsMask =
58
63
  [RCTSharedApplication() supportedInterfaceOrientationsForWindow:[RCTSharedApplication() keyWindow]];
64
+ #else // [visionOS
65
+ UIInterfaceOrientationMask appSupportedOrientationsMask = UIInterfaceOrientationMaskAll;
66
+ #endif // visionOS]
59
67
  if (!(_supportedInterfaceOrientations & appSupportedOrientationsMask)) {
60
68
  RCTLogError(
61
69
  @"Modal was presented with 0x%x orientations mask but the application only supports 0x%x."
@@ -30,7 +30,9 @@
30
30
 
31
31
  if ((self = [super initWithNibName:nil bundle:nil])) {
32
32
  _contentView = contentView;
33
+ #if TARGET_OS_IOS // [visionOS]
33
34
  self.automaticallyAdjustsScrollViewInsets = NO;
35
+ #endif // [visionOS]
34
36
  }
35
37
  return self;
36
38
  }
@@ -1403,7 +1403,9 @@ RCT_SET_AND_PRESERVE_OFFSET(setCanCancelContentTouches, canCancelContentTouches,
1403
1403
  RCT_SET_AND_PRESERVE_OFFSET(setDecelerationRate, decelerationRate, CGFloat)
1404
1404
  RCT_SET_AND_PRESERVE_OFFSET(setDirectionalLockEnabled, isDirectionalLockEnabled, BOOL)
1405
1405
  RCT_SET_AND_PRESERVE_OFFSET(setIndicatorStyle, indicatorStyle, UIScrollViewIndicatorStyle)
1406
+ #if TARGET_OS_IOS // [visionOS]
1406
1407
  RCT_SET_AND_PRESERVE_OFFSET(setKeyboardDismissMode, keyboardDismissMode, UIScrollViewKeyboardDismissMode)
1408
+ #endif // visionOS]
1407
1409
  RCT_SET_AND_PRESERVE_OFFSET(setMaximumZoomScale, maximumZoomScale, CGFloat)
1408
1410
  RCT_SET_AND_PRESERVE_OFFSET(setMinimumZoomScale, minimumZoomScale, CGFloat)
1409
1411
  #endif // [macOS]
@@ -1415,7 +1417,9 @@ RCT_SET_AND_PRESERVE_OFFSET(setScrollsToTop, scrollsToTop, BOOL)
1415
1417
  RCT_SET_AND_PRESERVE_OFFSET(setShowsHorizontalScrollIndicator, showsHorizontalScrollIndicator, BOOL)
1416
1418
  RCT_SET_AND_PRESERVE_OFFSET(setShowsVerticalScrollIndicator, showsVerticalScrollIndicator, BOOL)
1417
1419
  RCT_SET_AND_PRESERVE_OFFSET(setZoomScale, zoomScale, CGFloat);
1420
+ #if !TARGET_OS_VISION // [visionOS]
1418
1421
  RCT_SET_AND_PRESERVE_OFFSET(setScrollIndicatorInsets, scrollIndicatorInsets, UIEdgeInsets);
1422
+ #endif // [visionOS]
1419
1423
 
1420
1424
  #if !TARGET_OS_OSX // [macOS]
1421
1425
  - (void)setAutomaticallyAdjustsScrollIndicatorInsets:(BOOL)automaticallyAdjusts API_AVAILABLE(ios(13.0))
@@ -11,7 +11,9 @@
11
11
  #if !TARGET_OS_OSX // [macOS]
12
12
  @interface RCTConvert (UIScrollView)
13
13
 
14
+ #if TARGET_OS_IOS // [visionOS]
14
15
  + (UIScrollViewKeyboardDismissMode)UIScrollViewKeyboardDismissMode:(id)json;
16
+ #endif // [visionOS]
15
17
 
16
18
  @end
17
19
  #endif // [macOS]
@@ -12,7 +12,7 @@
12
12
  #import "RCTShadowView.h"
13
13
  #import "RCTUIManager.h"
14
14
 
15
- #if !TARGET_OS_OSX // [macOS]
15
+ #if TARGET_OS_IOS // [macOS] [visionOS]
16
16
  @implementation RCTConvert (UIScrollView)
17
17
 
18
18
  RCT_ENUM_CONVERTER(
@@ -49,7 +49,7 @@ RCT_ENUM_CONVERTER(
49
49
  integerValue)
50
50
 
51
51
  @end
52
- #endif // [macOS]
52
+ #endif // [macOS] [visionOS]
53
53
 
54
54
  @implementation RCTScrollViewManager
55
55
 
@@ -72,7 +72,9 @@ RCT_EXPORT_NOT_OSX_VIEW_PROPERTY(automaticallyAdjustKeyboardInsets, BOOL) // [ma
72
72
  RCT_EXPORT_NOT_OSX_VIEW_PROPERTY(decelerationRate, CGFloat) // [macOS]
73
73
  RCT_EXPORT_NOT_OSX_VIEW_PROPERTY(directionalLockEnabled, BOOL) // [macOS]
74
74
  RCT_EXPORT_NOT_OSX_VIEW_PROPERTY(indicatorStyle, UIScrollViewIndicatorStyle) // [macOS]
75
+ #if TARGET_OS_IOS // [visionOS]
75
76
  RCT_EXPORT_NOT_OSX_VIEW_PROPERTY(keyboardDismissMode, UIScrollViewKeyboardDismissMode) // [macOS]
77
+ #endif // [visionOS]
76
78
  RCT_EXPORT_NOT_OSX_VIEW_PROPERTY(maximumZoomScale, CGFloat) // [macOS]
77
79
  RCT_EXPORT_NOT_OSX_VIEW_PROPERTY(minimumZoomScale, CGFloat) // [macOS]
78
80
  RCT_EXPORT_VIEW_PROPERTY(scrollEnabled, BOOL)
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.73.10
1
+ VERSION_NAME=0.73.11
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", 10,
20
+ "patch", 11,
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 = 10;
20
+ int32_t Patch = 11;
21
21
  std::string_view Prerelease = "";
22
22
  } ReactNativeVersion;
23
23
 
@@ -46,8 +46,12 @@ RCT_EXPORT_MODULE()
46
46
  __block NSDictionary *constants;
47
47
  RCTUnsafeExecuteOnMainQueueSync(^{
48
48
  #if !TARGET_OS_OSX // [macOS]
49
+ #if !TARGET_OS_VISION // [visionOS]
49
50
  UIScreen *mainScreen = UIScreen.mainScreen;
50
51
  CGSize screenSize = mainScreen.bounds.size;
52
+ #else // [visionOS
53
+ CGSize screenSize = CGSizeZero;
54
+ #endif // visionOS]
51
55
  #else // [macOS
52
56
  NSScreen *mainScreen = NSScreen.mainScreen;
53
57
  CGSize screenSize = mainScreen.frame.size;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-macos",
3
- "version": "0.73.10",
3
+ "version": "0.73.11",
4
4
  "description": "React Native for macOS",
5
5
  "license": "MIT",
6
6
  "repository": {