react-native-macos 0.73.9 → 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 (44) 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/CoreModules/React-CoreModules.podspec +1 -1
  22. package/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryComponentView.mm +4 -0
  23. package/React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.mm +8 -0
  24. package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +6 -4
  25. package/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm +7 -15
  26. package/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm +3 -1
  27. package/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.mm +2 -2
  28. package/React/Fabric/RCTSurfacePointerHandler.mm +8 -1
  29. package/React/Fabric/RCTSurfaceTouchHandler.mm +4 -0
  30. package/React/Modules/RCTUIManager.m +4 -2
  31. package/React/React-RCTFabric.podspec +5 -2
  32. package/React/UIUtils/RCTUIUtils.m +21 -4
  33. package/React/Views/RCTModalHostView.m +2 -0
  34. package/React/Views/RCTModalHostViewController.m +8 -0
  35. package/React/Views/RCTWrapperViewController.m +2 -0
  36. package/React/Views/ScrollView/RCTScrollView.m +4 -0
  37. package/React/Views/ScrollView/RCTScrollViewManager.h +2 -0
  38. package/React/Views/ScrollView/RCTScrollViewManager.m +4 -2
  39. package/React-Core.podspec +1 -1
  40. package/ReactAndroid/gradle.properties +1 -1
  41. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
  42. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  43. package/ReactCommon/react/nativemodule/samples/platform/ios/ReactCommon/RCTSampleTurboModule.mm +4 -0
  44. package/package.json +1 -1
@@ -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)
@@ -18,7 +18,7 @@ end
18
18
 
19
19
  folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_CFG_NO_COROUTINES=1 -Wno-comma -Wno-shorten-64-to-32'
20
20
  folly_version = '2022.05.16.00'
21
- socket_rocket_version = '0.7.0' # [macOS]
21
+ socket_rocket_version = '0.7.0' # [macOS] [visionOS]
22
22
 
23
23
  header_search_paths = [
24
24
  "\"$(PODS_TARGET_SRCROOT)/React/CoreModules\"",
@@ -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)
@@ -18,7 +18,7 @@ end
18
18
 
19
19
  folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_CFG_NO_COROUTINES=1 -Wno-comma -Wno-shorten-64-to-32'
20
20
  folly_version = '2022.05.16.00'
21
- socket_rocket_version = '0.7.0' # [macOS]
21
+ socket_rocket_version = '0.7.0' # [macOS] [visionOS]
22
22
  boost_compiler_flags = '-Wno-documentation'
23
23
 
24
24
  use_hermes = ENV['USE_HERMES'] == nil || ENV['USE_HERMES'] == '1'
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.73.9
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", 9,
20
+ "patch", 11,
21
21
  "prerelease", null);
22
22
  }