react-native-macos 0.0.0-08d0c3b4f → 0.0.0-0c343d926

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 (208) hide show
  1. package/Libraries/Alert/Alert.js +115 -6
  2. package/Libraries/Alert/NativeAlertManager.js +1 -19
  3. package/Libraries/Blob/React-RCTBlob.podspec +1 -1
  4. package/Libraries/Components/View/ViewAccessibility.js +0 -5
  5. package/Libraries/Components/View/ViewPropTypes.js +95 -115
  6. package/Libraries/Core/ReactNativeVersion.js +1 -1
  7. package/Libraries/Image/React-RCTImage.podspec +1 -1
  8. package/Libraries/LinkingIOS/React-RCTLinking.podspec +1 -1
  9. package/Libraries/NativeAnimation/Nodes/RCTColorAnimatedNode.h +14 -0
  10. package/Libraries/NativeAnimation/Nodes/RCTColorAnimatedNode.m +30 -0
  11. package/Libraries/NativeAnimation/Nodes/RCTPropsAnimatedNode.m +11 -6
  12. package/Libraries/NativeAnimation/Nodes/RCTStyleAnimatedNode.m +8 -4
  13. package/Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.m +2 -0
  14. package/Libraries/NativeAnimation/React-RCTAnimation.podspec +2 -2
  15. package/Libraries/Network/React-RCTNetwork.podspec +1 -1
  16. package/Libraries/PushNotificationIOS/React-RCTPushNotification.podspec +1 -1
  17. package/Libraries/Settings/React-RCTSettings.podspec +1 -1
  18. package/Libraries/Text/BaseText/RCTBaseTextViewManager.m +7 -0
  19. package/Libraries/Text/RCTTextAttributes.h +9 -3
  20. package/Libraries/Text/RCTTextAttributes.m +17 -0
  21. package/Libraries/Text/Text/RCTTextView.m +5 -11
  22. package/Libraries/Text/Text.js +0 -6
  23. package/Libraries/Text/TextInput/RCTBackedTextInputViewProtocol.h +2 -2
  24. package/Libraries/TypeSafety/RCTTypeSafety.podspec +1 -1
  25. package/Libraries/Vibration/React-RCTVibration.podspec +1 -1
  26. package/React/Base/RCTAssert.h +30 -16
  27. package/React/Base/RCTAssert.m +53 -22
  28. package/React/Base/RCTBridge.m +5 -3
  29. package/React/Base/RCTEventDispatcherProtocol.h +5 -0
  30. package/React/Base/RCTUIKit.h +54 -0
  31. package/React/Base/RCTVersion.m +1 -1
  32. package/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.mm +0 -1
  33. package/React/Base/macOS/RCTUIKit.m +38 -0
  34. package/React/CoreModules/RCTAlertManager.mm +1 -1
  35. package/React/CoreModules/RCTEventDispatcher.mm +6 -1
  36. package/React/CoreModules/RCTLogBox.h +1 -1
  37. package/React/CoreModules/RCTLogBox.mm +35 -19
  38. package/React/CoreModules/RCTLogBoxView.h +8 -5
  39. package/React/CoreModules/RCTLogBoxView.mm +64 -23
  40. package/React/CoreModules/React-CoreModules.podspec +1 -1
  41. package/React/FBReactNativeSpec/FBReactNativeSpec.podspec +1 -1
  42. package/React/Fabric/Mounting/ComponentViews/ActivityIndicator/RCTActivityIndicatorViewComponentView.h +1 -1
  43. package/React/Fabric/Mounting/ComponentViews/ActivityIndicator/RCTActivityIndicatorViewComponentView.mm +3 -2
  44. package/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryComponentView.h +1 -1
  45. package/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryComponentView.mm +8 -8
  46. package/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryContentView.h +2 -2
  47. package/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryContentView.mm +3 -3
  48. package/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.h +2 -1
  49. package/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm +75 -29
  50. package/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropCoordinatorAdapter.h +1 -1
  51. package/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropCoordinatorAdapter.mm +1 -1
  52. package/React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.h +1 -1
  53. package/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.h +2 -0
  54. package/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.mm +8 -4
  55. package/React/Fabric/Mounting/ComponentViews/Root/RCTRootComponentView.h +1 -1
  56. package/React/Fabric/Mounting/ComponentViews/SafeAreaView/RCTSafeAreaViewComponentView.h +1 -1
  57. package/React/Fabric/Mounting/ComponentViews/SafeAreaView/RCTSafeAreaViewComponentView.mm +0 -1
  58. package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.h +5 -3
  59. package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.mm +23 -6
  60. package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTPullToRefreshViewComponentView.h +1 -1
  61. package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTPullToRefreshViewComponentView.mm +16 -0
  62. package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.h +6 -4
  63. package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +66 -28
  64. package/React/Fabric/Mounting/ComponentViews/Slider/RCTSliderComponentView.h +1 -1
  65. package/React/Fabric/Mounting/ComponentViews/Slider/RCTSliderComponentView.mm +5 -5
  66. package/React/Fabric/Mounting/ComponentViews/Switch/RCTSwitchComponentView.h +1 -1
  67. package/React/Fabric/Mounting/ComponentViews/Switch/RCTSwitchComponentView.mm +3 -3
  68. package/React/Fabric/Mounting/ComponentViews/Text/RCTAccessibilityElement.h +1 -1
  69. package/React/Fabric/Mounting/ComponentViews/Text/RCTAccessibilityElement.mm +1 -1
  70. package/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentAccessibilityProvider.h +2 -2
  71. package/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentAccessibilityProvider.mm +2 -2
  72. package/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.h +1 -1
  73. package/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm +3 -0
  74. package/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.h +1 -1
  75. package/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm +39 -5
  76. package/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.h +9 -6
  77. package/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.mm +16 -4
  78. package/React/Fabric/Mounting/ComponentViews/UnimplementedComponent/RCTUnimplementedNativeComponentView.h +2 -1
  79. package/React/Fabric/Mounting/ComponentViews/UnimplementedComponent/RCTUnimplementedNativeComponentView.mm +6 -4
  80. package/React/Fabric/Mounting/ComponentViews/UnimplementedView/RCTUnimplementedViewComponentView.h +1 -1
  81. package/React/Fabric/Mounting/ComponentViews/UnimplementedView/RCTUnimplementedViewComponentView.mm +14 -4
  82. package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.h +5 -5
  83. package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +23 -22
  84. package/React/Fabric/Mounting/RCTComponentViewClassDescriptor.h +1 -1
  85. package/React/Fabric/Mounting/RCTComponentViewDescriptor.h +2 -2
  86. package/React/Fabric/Mounting/RCTComponentViewFactory.h +1 -1
  87. package/React/Fabric/Mounting/RCTComponentViewFactory.mm +10 -1
  88. package/React/Fabric/Mounting/RCTComponentViewProtocol.h +4 -4
  89. package/React/Fabric/Mounting/RCTComponentViewRegistry.h +2 -2
  90. package/React/Fabric/Mounting/RCTComponentViewRegistry.mm +3 -1
  91. package/React/Fabric/Mounting/RCTMountingManager.h +3 -3
  92. package/React/Fabric/Mounting/RCTMountingManager.mm +19 -11
  93. package/React/Fabric/Mounting/RCTMountingManagerDelegate.h +1 -1
  94. package/React/Fabric/Mounting/RCTMountingTransactionObserving.h +1 -1
  95. package/React/Fabric/Mounting/UIView+ComponentViewProtocol.h +6 -6
  96. package/React/Fabric/Mounting/UIView+ComponentViewProtocol.mm +6 -6
  97. package/React/Fabric/RCTConversions.h +6 -6
  98. package/React/Fabric/RCTImageResponseDelegate.h +1 -1
  99. package/React/Fabric/RCTLocalizationProvider.h +1 -1
  100. package/React/Fabric/RCTScheduler.h +3 -1
  101. package/React/Fabric/RCTScheduler.mm +5 -0
  102. package/React/Fabric/RCTSurfacePresenter.h +8 -2
  103. package/React/Fabric/RCTSurfacePresenter.mm +47 -16
  104. package/React/Fabric/RCTSurfacePresenterBridgeAdapter.h +1 -1
  105. package/React/Fabric/RCTSurfaceRegistry.h +1 -1
  106. package/React/Fabric/RCTSurfaceTouchHandler.h +3 -3
  107. package/React/Fabric/RCTSurfaceTouchHandler.mm +8 -8
  108. package/React/Fabric/RCTTouchableComponentViewProtocol.h +1 -1
  109. package/React/Fabric/Surface/RCTFabricSurface.mm +1 -1
  110. package/React/Fabric/Utils/RCTGenericDelegateSplitter.h +1 -1
  111. package/React/Modules/RCTSurfacePresenterStub.h +4 -0
  112. package/React/Modules/RCTUIManager.m +2 -1
  113. package/React/React-RCTFabric.podspec +1 -1
  114. package/React/Views/RCTMaskedView.h +1 -1
  115. package/React/Views/RCTModalHostView.h +2 -2
  116. package/React/Views/RCTModalHostViewController.h +1 -1
  117. package/React/Views/RCTModalManager.h +1 -1
  118. package/React/Views/RCTSwitch.h +1 -10
  119. package/React/Views/RCTSwitch.m +0 -20
  120. package/React/Views/RCTSwitchManager.m +0 -4
  121. package/React/Views/RCTView.m +1 -1
  122. package/React/Views/RCTViewManager.m +2 -1
  123. package/React/Views/RCTWeakViewHolder.h +1 -1
  124. package/React/Views/RCTWrapperViewController.h +2 -2
  125. package/React/Views/RefreshControl/RCTRefreshControl.h +2 -2
  126. package/React/Views/RefreshControl/RCTRefreshableProtocol.h +1 -1
  127. package/React/Views/SafeAreaView/RCTSafeAreaView.h +1 -1
  128. package/React/Views/SafeAreaView/RCTSafeAreaViewLocalData.h +1 -1
  129. package/React/Views/ScrollView/RCTScrollView.m +0 -30
  130. package/React/Views/ScrollView/RCTScrollableProtocol.h +1 -1
  131. package/ReactAndroid/gradle.properties +1 -1
  132. package/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/viewPropConversions.h +527 -0
  133. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
  134. package/ReactAndroid/src/main/jni/Application.mk +1 -1
  135. package/ReactAndroid/src/main/jni/first-party/fb/BUCK +1 -1
  136. package/ReactAndroid/src/main/jni/react/jni/Android.mk +2 -2
  137. package/ReactCommon/ReactCommon.podspec +1 -1
  138. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  139. package/ReactCommon/cxxreact/tests/BUCK +1 -1
  140. package/ReactCommon/hermes/inspector/tools/msggen/yarn.lock +3 -3
  141. package/ReactCommon/microprofiler/BUCK +1 -1
  142. package/ReactCommon/react/debug/react_native_assert.h +1 -1
  143. package/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.cpp +6 -6
  144. package/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.h +4 -3
  145. package/ReactCommon/react/renderer/animations/conversions.h +11 -11
  146. package/ReactCommon/react/renderer/animations/tests/LayoutAnimationTest.cpp +1 -1
  147. package/ReactCommon/react/renderer/attributedstring/TextAttributes.cpp +16 -16
  148. package/ReactCommon/react/renderer/attributedstring/TextAttributes.h +14 -14
  149. package/ReactCommon/react/renderer/attributedstring/conversions.h +1 -1
  150. package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropComponentDescriptor.mm +5 -0
  151. package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.h +3 -3
  152. package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.mm +7 -5
  153. package/ReactCommon/react/renderer/components/text/ParagraphShadowNode.h +1 -1
  154. package/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputShadowNode.h +1 -1
  155. package/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputProps.cpp +1 -1
  156. package/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputProps.h +1 -1
  157. package/ReactCommon/react/renderer/components/textinput/iostextinput/primitives.h +3 -4
  158. package/ReactCommon/react/renderer/components/view/AccessibilityPrimitives.h +6 -6
  159. package/ReactCommon/react/renderer/components/view/ViewProps.h +3 -1
  160. package/ReactCommon/react/renderer/components/view/ViewPropsInterpolation.h +3 -3
  161. package/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.cpp +16 -16
  162. package/ReactCommon/react/renderer/components/view/conversions.h +5 -6
  163. package/ReactCommon/react/renderer/components/view/primitives.h +4 -3
  164. package/ReactCommon/react/renderer/components/view/propsConversions.h +2 -0
  165. package/ReactCommon/react/renderer/core/ComponentDescriptor.h +5 -5
  166. package/ReactCommon/react/renderer/core/ConcreteComponentDescriptor.h +7 -7
  167. package/ReactCommon/react/renderer/core/ConcreteShadowNode.h +2 -2
  168. package/ReactCommon/react/renderer/core/Props.h +0 -4
  169. package/ReactCommon/react/renderer/core/RawProps.h +1 -1
  170. package/ReactCommon/react/renderer/core/ShadowNode.cpp +2 -2
  171. package/ReactCommon/react/renderer/core/ShadowNode.h +5 -5
  172. package/ReactCommon/react/renderer/core/propsConversions.h +6 -5
  173. package/ReactCommon/react/renderer/core/tests/ComponentDescriptorTest.cpp +3 -3
  174. package/ReactCommon/react/renderer/debug/debugStringConvertibleUtils.h +3 -3
  175. package/ReactCommon/react/renderer/graphics/platform/ios/Color.h +1 -1
  176. package/ReactCommon/react/renderer/graphics/platform/ios/RCTPlatformColorUtils.mm +9 -9
  177. package/ReactCommon/react/renderer/imagemanager/platform/ios/RCTImageManager.h +1 -1
  178. package/ReactCommon/react/renderer/imagemanager/platform/ios/RCTImagePrimitivesConversions.h +1 -1
  179. package/ReactCommon/react/renderer/imagemanager/platform/ios/RCTSyncImageManager.h +1 -1
  180. package/ReactCommon/react/renderer/mounting/MountingCoordinator.cpp +2 -2
  181. package/ReactCommon/react/renderer/mounting/MountingCoordinator.h +3 -3
  182. package/ReactCommon/react/renderer/mounting/MountingOverrideDelegate.h +1 -1
  183. package/ReactCommon/react/renderer/mounting/ShadowTreeRevision.h +0 -2
  184. package/ReactCommon/react/renderer/mounting/StubView.h +1 -1
  185. package/ReactCommon/react/renderer/mounting/StubViewTree.cpp +1 -1
  186. package/ReactCommon/react/renderer/runtimescheduler/RuntimeScheduler.cpp +3 -2
  187. package/ReactCommon/react/renderer/runtimescheduler/RuntimeScheduler.h +7 -1
  188. package/ReactCommon/react/renderer/runtimescheduler/Task.h +3 -2
  189. package/ReactCommon/react/renderer/scheduler/Scheduler.cpp +5 -2
  190. package/ReactCommon/react/renderer/scheduler/Scheduler.h +4 -1
  191. package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/NSTextStorage+FontScaling.h +1 -1
  192. package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTAttributedTextUtils.h +1 -1
  193. package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTAttributedTextUtils.mm +15 -15
  194. package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTFontProperties.h +1 -1
  195. package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTFontUtils.h +1 -1
  196. package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTTextLayoutManager.h +1 -1
  197. package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTTextPrimitivesConversions.h +6 -6
  198. package/ReactCommon/react/utils/ContextContainer.h +2 -2
  199. package/ReactCommon/react/utils/SimpleThreadSafeCache.h +2 -2
  200. package/ReactCommon/yoga/Yoga.podspec +1 -1
  201. package/index.js +0 -11
  202. package/local-cli/generator-macos/templates/macos/HelloWorld-macOS/ViewController.m +1 -1
  203. package/package.json +4 -1
  204. package/scripts/react_native_pods.rb +1 -1
  205. package/template/Gemfile.lock +1 -1
  206. package/template/package.json +1 -1
  207. package/Libraries/Alert/AlertMacOS.js +0 -211
  208. package/ReactCommon/butter/optional.h +0 -38
@@ -117,7 +117,16 @@ static Class<RCTComponentViewProtocol> RCTComponentViewClassWithName(const char
117
117
  }
118
118
 
119
119
  // Fallback 2: Try to use Paper Interop.
120
- if ([RCTLegacyViewManagerInteropComponentView isSupported:RCTNSStringFromString(name)]) {
120
+ NSString *componentNameString = RCTNSStringFromString(name);
121
+ if ([RCTLegacyViewManagerInteropComponentView isSupported:componentNameString]) {
122
+ RCTLogNewArchitectureValidation(
123
+ RCTNotAllowedInBridgeless,
124
+ self,
125
+ [NSString
126
+ stringWithFormat:
127
+ @"Legacy ViewManagers should be migrated to Fabric ComponentViews in the new architecture to reduce risk. Component using interop layer: %@",
128
+ componentNameString]);
129
+
121
130
  auto flavor = std::make_shared<std::string const>(name);
122
131
  auto componentName = ComponentName{flavor->c_str()};
123
132
  auto componentHandle = reinterpret_cast<ComponentHandle>(componentName);
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- #import <UIKit/UIKit.h>
8
+ #import <React/RCTUIKit.h> // TODO(macOS GH#774)
9
9
 
10
10
  #import <react/renderer/componentregistry/ComponentDescriptorProvider.h>
11
11
  #import <react/renderer/core/EventEmitter.h>
@@ -54,14 +54,14 @@ typedef NS_OPTIONS(NSInteger, RNComponentViewUpdateMask) {
54
54
  * component view.
55
55
  * Receiver must add `childComponentView` as a subview.
56
56
  */
57
- - (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index;
57
+ - (void)mountChildComponentView:(RCTUIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index; // TODO(macOS GH#774)
58
58
 
59
59
  /*
60
60
  * Called for unmounting (detaching) a child component view from `self`
61
61
  * component view.
62
62
  * Receiver must remove `childComponentView` as a subview.
63
63
  */
64
- - (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index;
64
+ - (void)unmountChildComponentView:(RCTUIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index; // TODO(macOS GH#774)
65
65
 
66
66
  /*
67
67
  * Called for updating component's props.
@@ -114,7 +114,7 @@ typedef NS_OPTIONS(NSInteger, RNComponentViewUpdateMask) {
114
114
  /*
115
115
  * Read the last props used to update the view.
116
116
  */
117
- - (facebook::react::SharedProps)props;
117
+ - (facebook::react::Props::Shared)props;
118
118
 
119
119
  - (BOOL)isJSResponder;
120
120
  - (void)setIsJSResponder:(BOOL)isJSResponder;
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- #import <UIKit/UIKit.h>
8
+ #import <React/RCTUIKit.h> // TODO(macOS GH#774)
9
9
 
10
10
  #import <React/RCTComponentViewDescriptor.h>
11
11
  #import <React/RCTComponentViewFactory.h>
@@ -48,7 +48,7 @@ NS_ASSUME_NONNULL_BEGIN
48
48
  * Finds a native component view by given `tag`.
49
49
  * Returns `nil` if there is no registered component with the `tag`.
50
50
  */
51
- - (nullable UIView<RCTComponentViewProtocol> *)findComponentViewWithTag:(facebook::react::Tag)tag;
51
+ - (nullable RCTUIView<RCTComponentViewProtocol> *)findComponentViewWithTag:(facebook::react::Tag)tag; // TODO(macOS GH#774)
52
52
 
53
53
  /**
54
54
  * Creates a component view with a given type and puts it to the recycle pool.
@@ -31,10 +31,12 @@ const NSInteger RCTComponentViewRegistryRecyclePoolMaxSize = 1024;
31
31
  if (self = [super init]) {
32
32
  _componentViewFactory = [RCTComponentViewFactory currentComponentViewFactory];
33
33
 
34
+ #if !TARGET_OS_OSX // [TODO(macOS GH#774)
34
35
  [[NSNotificationCenter defaultCenter] addObserver:self
35
36
  selector:@selector(handleApplicationDidReceiveMemoryWarningNotification)
36
37
  name:UIApplicationDidReceiveMemoryWarningNotification
37
38
  object:nil];
39
+ #endif // ]TODO(macOS GH#774)
38
40
 
39
41
  dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
40
42
  // Calling this a bit later, when the main thread is probably idle while JavaScript thread is busy.
@@ -116,7 +118,7 @@ const NSInteger RCTComponentViewRegistryRecyclePoolMaxSize = 1024;
116
118
  return iterator->second;
117
119
  }
118
120
 
119
- - (nullable UIView<RCTComponentViewProtocol> *)findComponentViewWithTag:(Tag)tag
121
+ - (nullable RCTUIView<RCTComponentViewProtocol> *)findComponentViewWithTag:(Tag)tag // TODO(macOS GH#774)
120
122
  {
121
123
  RCTAssertMainQueue();
122
124
  auto iterator = _registry.find(tag);
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- #import <UIKit/UIKit.h>
8
+ #import <React/RCTUIKit.h> // TODO(macOS GH#774)
9
9
 
10
10
  #import <React/RCTMountingManagerDelegate.h>
11
11
  #import <React/RCTPrimitives.h>
@@ -36,12 +36,12 @@ NS_ASSUME_NONNULL_BEGIN
36
36
  * influence the intrinsic size of the view and cannot be measured using UIView/UIKit layout API.
37
37
  * Must be called on the main thead.
38
38
  */
39
- - (void)attachSurfaceToView:(UIView *)view surfaceId:(facebook::react::SurfaceId)surfaceId;
39
+ - (void)attachSurfaceToView:(RCTUIView *)view surfaceId:(facebook::react::SurfaceId)surfaceId; // TODO(macOS GH#774)
40
40
 
41
41
  /**
42
42
  * Stops designating the view as a rendering viewport of a React Native surface.
43
43
  */
44
- - (void)detachSurfaceFromView:(UIView *)view surfaceId:(facebook::react::SurfaceId)surfaceId;
44
+ - (void)detachSurfaceFromView:(RCTUIView *)view surfaceId:(facebook::react::SurfaceId)surfaceId; // TODO(macOS GH#774)
45
45
 
46
46
  /**
47
47
  * Schedule a mounting transaction to be performed on the main thread.
@@ -7,6 +7,7 @@
7
7
 
8
8
  #import "RCTMountingManager.h"
9
9
 
10
+ #import <QuartzCore/QuartzCore.h>
10
11
  #import <butter/map.h>
11
12
 
12
13
  #import <React/RCTAssert.h>
@@ -14,6 +15,7 @@
14
15
  #import <React/RCTFollyConvert.h>
15
16
  #import <React/RCTLog.h>
16
17
  #import <React/RCTUtils.h>
18
+ #import <react/config/ReactNativeConfig.h>
17
19
  #import <react/renderer/components/root/RootShadowNode.h>
18
20
  #import <react/renderer/core/LayoutableShadowNode.h>
19
21
  #import <react/renderer/core/RawProps.h>
@@ -27,7 +29,7 @@
27
29
 
28
30
  using namespace facebook::react;
29
31
 
30
- static SurfaceId RCTSurfaceIdForView(UIView *view)
32
+ static SurfaceId RCTSurfaceIdForView(RCTUIView *view) // TODO(macOS GH#774)
31
33
  {
32
34
  do {
33
35
  if (RCTIsReactRootView(@(view.tag))) {
@@ -79,7 +81,7 @@ static void RCTPerformMountInstructions(
79
81
  auto &newChildViewDescriptor = [registry componentViewDescriptorWithTag:newChildShadowView.tag];
80
82
  auto &parentViewDescriptor = [registry componentViewDescriptorWithTag:parentShadowView.tag];
81
83
 
82
- UIView<RCTComponentViewProtocol> *newChildComponentView = newChildViewDescriptor.view;
84
+ RCTUIView<RCTComponentViewProtocol> *newChildComponentView = newChildViewDescriptor.view; // TODO(macOS GH#774)
83
85
 
84
86
  RCTAssert(newChildShadowView.props, @"`newChildShadowView.props` must not be null.");
85
87
 
@@ -107,7 +109,7 @@ static void RCTPerformMountInstructions(
107
109
  auto &oldChildShadowView = mutation.oldChildShadowView;
108
110
  auto &newChildShadowView = mutation.newChildShadowView;
109
111
  auto &newChildViewDescriptor = [registry componentViewDescriptorWithTag:newChildShadowView.tag];
110
- UIView<RCTComponentViewProtocol> *newChildComponentView = newChildViewDescriptor.view;
112
+ RCTUIView<RCTComponentViewProtocol> *newChildComponentView = newChildViewDescriptor.view; // TODO(macOS GH#774)
111
113
 
112
114
  auto mask = RNComponentViewUpdateMask{};
113
115
 
@@ -166,7 +168,7 @@ static void RCTPerformMountInstructions(
166
168
  _contextContainer = contextContainer;
167
169
  }
168
170
 
169
- - (void)attachSurfaceToView:(UIView *)view surfaceId:(SurfaceId)surfaceId
171
+ - (void)attachSurfaceToView:(RCTUIView *)view surfaceId:(SurfaceId)surfaceId // TODO(macOS GH#774)
170
172
  {
171
173
  RCTAssertMainQueue();
172
174
 
@@ -177,7 +179,7 @@ static void RCTPerformMountInstructions(
177
179
  [view addSubview:rootViewDescriptor.view];
178
180
  }
179
181
 
180
- - (void)detachSurfaceFromView:(UIView *)view surfaceId:(SurfaceId)surfaceId
182
+ - (void)detachSurfaceFromView:(RCTUIView *)view surfaceId:(SurfaceId)surfaceId // TODO(macOS GH#774)
181
183
  {
182
184
  RCTAssertMainQueue();
183
185
  RCTComponentViewDescriptor rootViewDescriptor = [_componentViewRegistry componentViewDescriptorWithTag:surfaceId];
@@ -285,7 +287,8 @@ static void RCTPerformMountInstructions(
285
287
  {
286
288
  ReactTag reactTag = shadowView.tag;
287
289
  RCTExecuteOnMainQueue(^{
288
- UIView<RCTComponentViewProtocol> *componentView = [self->_componentViewRegistry findComponentViewWithTag:reactTag];
290
+ RCTUIView<RCTComponentViewProtocol> *componentView =
291
+ [self->_componentViewRegistry findComponentViewWithTag:reactTag]; // TODO(macOS GH#774)
289
292
  [componentView setIsJSResponder:isJSResponder];
290
293
  });
291
294
  }
@@ -295,10 +298,10 @@ static void RCTPerformMountInstructions(
295
298
  componentDescriptor:(const ComponentDescriptor &)componentDescriptor
296
299
  {
297
300
  RCTAssertMainQueue();
298
- UIView<RCTComponentViewProtocol> *componentView = [_componentViewRegistry findComponentViewWithTag:reactTag];
301
+ RCTUIView<RCTComponentViewProtocol> *componentView = [_componentViewRegistry findComponentViewWithTag:reactTag]; // TODO(macOS GH#774)
299
302
  SurfaceId surfaceId = RCTSurfaceIdForView(componentView);
300
- SharedProps oldProps = [componentView props];
301
- SharedProps newProps = componentDescriptor.cloneProps(
303
+ Props::Shared oldProps = [componentView props];
304
+ Props::Shared newProps = componentDescriptor.cloneProps(
302
305
  PropsParserContext{surfaceId, *_contextContainer.get()}, oldProps, RawProps(convertIdToFollyDynamic(props)));
303
306
 
304
307
  NSSet<NSString *> *propKeys = componentView.propKeysManagedByAnimated_DO_NOT_USE_THIS_IS_BROKEN ?: [NSSet new];
@@ -317,6 +320,11 @@ static void RCTPerformMountInstructions(
317
320
  if (props[@"opacity"] && componentView.layer.opacity != (float)newViewProps.opacity) {
318
321
  componentView.layer.opacity = newViewProps.opacity;
319
322
  }
323
+
324
+ auto reactNativeConfig = _contextContainer->at<std::shared_ptr<ReactNativeConfig const>>("ReactNativeConfig");
325
+ if (reactNativeConfig && reactNativeConfig->getBool("react_fabric:finalize_updates_on_synchronous_update_view_ios")) {
326
+ [componentView finalizeUpdates:RNComponentViewUpdateMaskProps];
327
+ }
320
328
  }
321
329
 
322
330
  - (void)synchronouslyDispatchCommandOnUIThread:(ReactTag)reactTag
@@ -324,14 +332,14 @@ static void RCTPerformMountInstructions(
324
332
  args:(NSArray *)args
325
333
  {
326
334
  RCTAssertMainQueue();
327
- UIView<RCTComponentViewProtocol> *componentView = [_componentViewRegistry findComponentViewWithTag:reactTag];
335
+ RCTUIView<RCTComponentViewProtocol> *componentView = [_componentViewRegistry findComponentViewWithTag:reactTag]; // TODO(macOS GH#774)
328
336
  [componentView handleCommand:commandName args:args];
329
337
  }
330
338
 
331
339
  - (void)synchronouslyDispatchAccessbilityEventOnUIThread:(ReactTag)reactTag eventType:(NSString *)eventType
332
340
  {
333
341
  if ([@"focus" isEqualToString:eventType]) {
334
- UIView<RCTComponentViewProtocol> *componentView = [_componentViewRegistry findComponentViewWithTag:reactTag];
342
+ RCTUIView<RCTComponentViewProtocol> *componentView = [_componentViewRegistry findComponentViewWithTag:reactTag]; // TODO(macOS GH#774)
335
343
  UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, componentView);
336
344
  }
337
345
  }
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- #import <UIKit/UIKit.h>
8
+ #import <React/RCTUIKit.h> // TODO(macOS GH#774)
9
9
 
10
10
  #import <React/RCTPrimitives.h>
11
11
 
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- #import <UIKit/UIKit.h>
8
+ #import <React/RCTUIKit.h> // TODO(macOS GH#774)
9
9
 
10
10
  #include <react/renderer/mounting/MountingTransaction.h>
11
11
 
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- #import <UIKit/UIKit.h>
8
+ #import <React/RCTUIKit.h> // TODO(macOS GH#774)
9
9
 
10
10
  #import <React/RCTComponentViewProtocol.h>
11
11
 
@@ -14,13 +14,13 @@ NS_ASSUME_NONNULL_BEGIN
14
14
  /**
15
15
  * Default implementation of RCTComponentViewProtocol.
16
16
  */
17
- @interface UIView (ComponentViewProtocol) <RCTComponentViewProtocol>
17
+ @interface RCTUIView (ComponentViewProtocol) <RCTComponentViewProtocol> // TODO(macOS GH#774)
18
18
 
19
19
  + (std::vector<facebook::react::ComponentDescriptorProvider>)supplementalComponentDescriptorProviders;
20
20
 
21
- - (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index;
21
+ - (void)mountChildComponentView:(RCTUIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index; // TODO(macOS GH#774)
22
22
 
23
- - (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index;
23
+ - (void)unmountChildComponentView:(RCTUIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index; // TODO(macOS GH#774)
24
24
 
25
25
  - (void)updateProps:(facebook::react::Props::Shared const &)props
26
26
  oldProps:(facebook::react::Props::Shared const &)oldProps;
@@ -37,14 +37,14 @@ NS_ASSUME_NONNULL_BEGIN
37
37
 
38
38
  - (void)prepareForRecycle;
39
39
 
40
- - (facebook::react::SharedProps)props;
40
+ - (facebook::react::Props::Shared)props;
41
41
 
42
42
  - (void)setIsJSResponder:(BOOL)isJSResponder;
43
43
 
44
44
  - (void)setPropKeysManagedByAnimated_DO_NOT_USE_THIS_IS_BROKEN:(nullable NSSet<NSString *> *)props;
45
45
  - (nullable NSSet<NSString *> *)propKeysManagedByAnimated_DO_NOT_USE_THIS_IS_BROKEN;
46
46
 
47
- - (void)updateClippedSubviewsWithClipRect:(CGRect)clipRect relativeToView:(UIView *)clipView;
47
+ - (void)updateClippedSubviewsWithClipRect:(CGRect)clipRect relativeToView:(RCTUIView *)clipView; // TODO(macOS GH#774)
48
48
 
49
49
  @end
50
50
 
@@ -15,7 +15,7 @@
15
15
 
16
16
  using namespace facebook::react;
17
17
 
18
- @implementation UIView (ComponentViewProtocol)
18
+ @implementation RCTUIView (ComponentViewProtocol) // TODO(macOS GH#774)
19
19
 
20
20
  + (ComponentDescriptorProvider)componentDescriptorProvider
21
21
  {
@@ -28,7 +28,7 @@ using namespace facebook::react;
28
28
  return {};
29
29
  }
30
30
 
31
- - (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
31
+ - (void)mountChildComponentView:(RCTUIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index // TODO(macOS GH#774)
32
32
  {
33
33
  RCTAssert(
34
34
  childComponentView.superview == nil,
@@ -40,7 +40,7 @@ using namespace facebook::react;
40
40
  [self insertSubview:childComponentView atIndex:index];
41
41
  }
42
42
 
43
- - (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
43
+ - (void)unmountChildComponentView:(RCTUIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index // TODO(macOS GH#774)
44
44
  {
45
45
  RCTAssert(
46
46
  childComponentView.superview == self,
@@ -129,7 +129,7 @@ using namespace facebook::react;
129
129
  // Default implementation does nothing.
130
130
  }
131
131
 
132
- - (facebook::react::SharedProps)props
132
+ - (facebook::react::Props::Shared)props
133
133
  {
134
134
  RCTAssert(NO, @"props access should be implemented by RCTViewComponentView.");
135
135
  return nullptr;
@@ -156,14 +156,14 @@ using namespace facebook::react;
156
156
  return nil;
157
157
  }
158
158
 
159
- - (void)updateClippedSubviewsWithClipRect:(CGRect)clipRect relativeToView:(UIView *)clipView
159
+ - (void)updateClippedSubviewsWithClipRect:(CGRect)clipRect relativeToView:(RCTUIView *)clipView // TODO(macOS GH#774)
160
160
  {
161
161
  clipRect = [clipView convertRect:clipRect toView:self];
162
162
 
163
163
  // Normal views don't support unmounting, so all
164
164
  // this does is forward message to our subviews,
165
165
  // in case any of those do support it
166
- for (UIView *subview in self.subviews) {
166
+ for (RCTUIView *subview in self.subviews) { // TODO(macOS GH#774)
167
167
  [subview updateClippedSubviewsWithClipRect:clipRect relativeToView:self];
168
168
  }
169
169
  }
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- #import <UIKit/UIKit.h>
8
+ #import <React/RCTUIKit.h> // TODO(macOS GH#774)
9
9
 
10
10
  #import <react/renderer/components/view/AccessibilityPrimitives.h>
11
11
  #import <react/renderer/components/view/primitives.h>
@@ -35,26 +35,26 @@ inline std::string RCTStringFromNSString(NSString *string)
35
35
  return std::string{string.UTF8String ?: ""};
36
36
  }
37
37
 
38
- inline UIColor *_Nullable RCTUIColorFromSharedColor(facebook::react::SharedColor const &sharedColor)
38
+ inline RCTUIColor *_Nullable RCTUIColorFromSharedColor(facebook::react::SharedColor const &sharedColor) // TODO(macOS GH#774)
39
39
  {
40
40
  if (!sharedColor) {
41
41
  return nil;
42
42
  }
43
43
 
44
44
  if (*facebook::react::clearColor() == *sharedColor) {
45
- return [UIColor clearColor];
45
+ return [RCTUIColor clearColor]; // TODO(macOS GH#774)
46
46
  }
47
47
 
48
48
  if (*facebook::react::blackColor() == *sharedColor) {
49
- return [UIColor blackColor];
49
+ return [RCTUIColor blackColor]; // TODO(macOS GH#774)
50
50
  }
51
51
 
52
52
  if (*facebook::react::whiteColor() == *sharedColor) {
53
- return [UIColor whiteColor];
53
+ return [RCTUIColor whiteColor]; // TODO(macOS GH#774)
54
54
  }
55
55
 
56
56
  auto components = facebook::react::colorComponentsFromColor(sharedColor);
57
- return [UIColor colorWithRed:components.red green:components.green blue:components.blue alpha:components.alpha];
57
+ return [RCTUIColor colorWithRed:components.red green:components.green blue:components.blue alpha:components.alpha]; // TODO(macOS GH#774)
58
58
  }
59
59
 
60
60
  inline CF_RETURNS_RETAINED CGColorRef
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- #import <UIKit/UIKit.h>
8
+ #import <React/RCTUIKit.h> // TODO(macOS GH#774)
9
9
 
10
10
  NS_ASSUME_NONNULL_BEGIN
11
11
 
@@ -6,7 +6,7 @@
6
6
  */
7
7
 
8
8
  #import <React/RCTDefines.h>
9
- #import <UIKit/UIKit.h>
9
+ #import <React/RCTUIKit.h> // TODO(macOS GH#774)
10
10
 
11
11
  @protocol RCTLocalizationProtocol <NSObject>
12
12
 
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- #import <UIKit/UIKit.h>
8
+ #import <React/RCTUIKit.h> // TODO(macOS GH#774)
9
9
  #import <memory>
10
10
 
11
11
  #import <react/renderer/componentregistry/ComponentDescriptorFactory.h>
@@ -16,6 +16,7 @@
16
16
  #import <react/renderer/mounting/MountingCoordinator.h>
17
17
  #import <react/renderer/scheduler/SchedulerToolbox.h>
18
18
  #import <react/renderer/scheduler/SurfaceHandler.h>
19
+ #import <react/renderer/uimanager/UIManager.h>
19
20
  #import <react/utils/ContextContainer.h>
20
21
 
21
22
  NS_ASSUME_NONNULL_BEGIN
@@ -48,6 +49,7 @@ NS_ASSUME_NONNULL_BEGIN
48
49
  @interface RCTScheduler : NSObject
49
50
 
50
51
  @property (atomic, weak, nullable) id<RCTSchedulerDelegate> delegate;
52
+ @property (readonly) std::shared_ptr<facebook::react::UIManager> const uiManager;
51
53
 
52
54
  - (instancetype)initWithToolbox:(facebook::react::SchedulerToolbox)toolbox;
53
55
 
@@ -203,4 +203,9 @@ class LayoutAnimationDelegateProxy : public LayoutAnimationStatusDelegate, publi
203
203
  return _scheduler->removeEventListener(listener);
204
204
  }
205
205
 
206
+ - (std::shared_ptr<facebook::react::UIManager> const)uiManager
207
+ {
208
+ return _scheduler->getUIManager();
209
+ }
210
+
206
211
  @end
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- #import <UIKit/UIKit.h>
8
+ #import <React/RCTUIKit.h> // TODO(macOS GH#774)
9
9
 
10
10
  #import <React/RCTPrimitives.h>
11
11
  #import <React/RCTSurfacePresenterStub.h>
@@ -56,6 +56,12 @@ NS_ASSUME_NONNULL_BEGIN
56
56
  @property (readonly) RCTMountingManager *mountingManager;
57
57
  @property (readonly, nullable) RCTScheduler *scheduler;
58
58
 
59
+ /*
60
+ * Allow callers to initialize a new fabric surface without adding Fabric as a Buck dependency.
61
+ */
62
+ - (id<RCTSurfaceProtocol>)createFabricSurfaceForModuleName:(NSString *)moduleName
63
+ initialProperties:(NSDictionary *)initialProperties;
64
+
59
65
  - (nullable RCTFabricSurface *)surfaceForRootTag:(ReactTag)rootTag;
60
66
 
61
67
  - (BOOL)synchronouslyUpdateViewOnUIThread:(NSNumber *)reactTag props:(NSDictionary *)props;
@@ -72,7 +78,7 @@ NS_ASSUME_NONNULL_BEGIN
72
78
  /*
73
79
  * Please do not use this, this will be deleted soon.
74
80
  */
75
- - (nullable UIView *)findComponentViewWithTag_DO_NOT_USE_DEPRECATED:(NSInteger)tag;
81
+ - (nullable RCTUIView *)findComponentViewWithTag_DO_NOT_USE_DEPRECATED:(NSInteger)tag; // TODO(macOS GH#774)
76
82
 
77
83
  @end
78
84
 
@@ -80,8 +80,7 @@ static BackgroundExecutor RCTGetBackgroundExecutor()
80
80
  RuntimeExecutor _runtimeExecutor; // Protected by `_schedulerLifeCycleMutex`.
81
81
 
82
82
  butter::shared_mutex _observerListMutex;
83
- NSMutableArray<id<RCTSurfacePresenterObserver>> *_observers;
84
- RCTImageLoader *_imageLoader;
83
+ std::vector<__weak id<RCTSurfacePresenterObserver>> _observers; // Protected by `_observerListMutex`.
85
84
  }
86
85
 
87
86
  - (instancetype)initWithContextContainer:(ContextContainer::Shared)contextContainer
@@ -97,8 +96,6 @@ static BackgroundExecutor RCTGetBackgroundExecutor()
97
96
  _mountingManager.contextContainer = contextContainer;
98
97
  _mountingManager.delegate = self;
99
98
 
100
- _observers = [NSMutableArray array];
101
-
102
99
  _scheduler = [self _createScheduler];
103
100
  }
104
101
 
@@ -166,10 +163,18 @@ static BackgroundExecutor RCTGetBackgroundExecutor()
166
163
  return [_surfaceRegistry surfaceForRootTag:rootTag];
167
164
  }
168
165
 
169
- - (UIView *)findComponentViewWithTag_DO_NOT_USE_DEPRECATED:(NSInteger)tag
166
+ - (id<RCTSurfaceProtocol>)createFabricSurfaceForModuleName:(NSString *)moduleName
167
+ initialProperties:(NSDictionary *)initialProperties
170
168
  {
171
- UIView<RCTComponentViewProtocol> *componentView =
172
- [_mountingManager.componentViewRegistry findComponentViewWithTag:tag];
169
+ return [[RCTFabricSurface alloc] initWithSurfacePresenter:self
170
+ moduleName:moduleName
171
+ initialProperties:initialProperties];
172
+ }
173
+
174
+ - (RCTUIView *)findComponentViewWithTag_DO_NOT_USE_DEPRECATED:(NSInteger)tag // TODO(macOS GH#774)
175
+ {
176
+ RCTUIView<RCTComponentViewProtocol> *componentView =
177
+ [_mountingManager.componentViewRegistry findComponentViewWithTag:tag]; // TODO(macOS GH#774)
173
178
  return componentView;
174
179
  }
175
180
 
@@ -181,8 +186,8 @@ static BackgroundExecutor RCTGetBackgroundExecutor()
181
186
  }
182
187
 
183
188
  ReactTag tag = [reactTag integerValue];
184
- UIView<RCTComponentViewProtocol> *componentView =
185
- [_mountingManager.componentViewRegistry findComponentViewWithTag:tag];
189
+ RCTUIView<RCTComponentViewProtocol> *componentView =
190
+ [_mountingManager.componentViewRegistry findComponentViewWithTag:tag]; // TODO(macOS GH#774)
186
191
  if (componentView == nil) {
187
192
  return NO; // This view probably isn't managed by Fabric
188
193
  }
@@ -274,7 +279,7 @@ static BackgroundExecutor RCTGetBackgroundExecutor()
274
279
  toolbox.componentRegistryFactory = componentRegistryFactory;
275
280
 
276
281
  auto weakRuntimeScheduler = _contextContainer->find<std::weak_ptr<RuntimeScheduler>>("RuntimeScheduler");
277
- auto runtimeScheduler = weakRuntimeScheduler.hasValue() ? weakRuntimeScheduler.value().lock() : nullptr;
282
+ auto runtimeScheduler = weakRuntimeScheduler.has_value() ? weakRuntimeScheduler.value().lock() : nullptr;
278
283
  if (runtimeScheduler) {
279
284
  runtimeExecutor = [runtimeScheduler](std::function<void(jsi::Runtime & runtime)> &&callback) {
280
285
  runtimeScheduler->scheduleWork(std::move(callback));
@@ -367,13 +372,17 @@ static BackgroundExecutor RCTGetBackgroundExecutor()
367
372
  - (void)addObserver:(id<RCTSurfacePresenterObserver>)observer
368
373
  {
369
374
  std::unique_lock<butter::shared_mutex> lock(_observerListMutex);
370
- [self->_observers addObject:observer];
375
+ _observers.push_back(observer);
371
376
  }
372
377
 
373
378
  - (void)removeObserver:(id<RCTSurfacePresenterObserver>)observer
374
379
  {
375
380
  std::unique_lock<butter::shared_mutex> lock(_observerListMutex);
376
- [self->_observers removeObject:observer];
381
+ std::vector<__weak id<RCTSurfacePresenterObserver>>::const_iterator it =
382
+ std::find(_observers.begin(), _observers.end(), observer);
383
+ if (it != _observers.end()) {
384
+ _observers.erase(it);
385
+ }
377
386
  }
378
387
 
379
388
  #pragma mark - RCTMountingManagerDelegate
@@ -382,8 +391,13 @@ static BackgroundExecutor RCTGetBackgroundExecutor()
382
391
  {
383
392
  RCTAssertMainQueue();
384
393
 
385
- std::shared_lock<butter::shared_mutex> lock(_observerListMutex);
386
- for (id<RCTSurfacePresenterObserver> observer in _observers) {
394
+ NSArray<id<RCTSurfacePresenterObserver>> *observersCopy;
395
+ {
396
+ std::shared_lock<butter::shared_mutex> lock(_observerListMutex);
397
+ observersCopy = [self _getObservers];
398
+ }
399
+
400
+ for (id<RCTSurfacePresenterObserver> observer in observersCopy) {
387
401
  if ([observer respondsToSelector:@selector(willMountComponentsWithRootTag:)]) {
388
402
  [observer willMountComponentsWithRootTag:rootTag];
389
403
  }
@@ -394,12 +408,29 @@ static BackgroundExecutor RCTGetBackgroundExecutor()
394
408
  {
395
409
  RCTAssertMainQueue();
396
410
 
397
- std::shared_lock<butter::shared_mutex> lock(_observerListMutex);
398
- for (id<RCTSurfacePresenterObserver> observer in _observers) {
411
+ NSArray<id<RCTSurfacePresenterObserver>> *observersCopy;
412
+ {
413
+ std::shared_lock<butter::shared_mutex> lock(_observerListMutex);
414
+ observersCopy = [self _getObservers];
415
+ }
416
+
417
+ for (id<RCTSurfacePresenterObserver> observer in observersCopy) {
399
418
  if ([observer respondsToSelector:@selector(didMountComponentsWithRootTag:)]) {
400
419
  [observer didMountComponentsWithRootTag:rootTag];
401
420
  }
402
421
  }
403
422
  }
404
423
 
424
+ - (NSArray<id<RCTSurfacePresenterObserver>> *)_getObservers
425
+ {
426
+ NSMutableArray<id<RCTSurfacePresenterObserver>> *observersCopy = [NSMutableArray new];
427
+ for (id<RCTSurfacePresenterObserver> observer : _observers) {
428
+ if (observer) {
429
+ [observersCopy addObject:observer];
430
+ }
431
+ }
432
+
433
+ return observersCopy;
434
+ }
435
+
405
436
  @end
@@ -7,7 +7,7 @@
7
7
 
8
8
  #import <Foundation/Foundation.h>
9
9
  #import <ReactCommon/RuntimeExecutor.h>
10
- #import <UIKit/UIKit.h>
10
+ #import <React/RCTUIKit.h> // TODO(macOS GH#774)
11
11
  #import <react/utils/ContextContainer.h>
12
12
 
13
13
  NS_ASSUME_NONNULL_BEGIN
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- #import <UIKit/UIKit.h>
8
+ #import <React/RCTUIKit.h> // TODO(macOS GH#774)
9
9
 
10
10
  #import <React/RCTPrimitives.h>
11
11
 
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- #import <UIKit/UIKit.h>
8
+ #import <React/RCTUIKit.h> // TODO(macOS GH#774)
9
9
 
10
10
  NS_ASSUME_NONNULL_BEGIN
11
11
 
@@ -15,8 +15,8 @@ NS_ASSUME_NONNULL_BEGIN
15
15
  * Attaches (and detaches) a view to the touch handler.
16
16
  * The receiver does not retain the provided view.
17
17
  */
18
- - (void)attachToView:(UIView *)view;
19
- - (void)detachFromView:(UIView *)view;
18
+ - (void)attachToView:(RCTUIView *)view; // TODO(macOS GH#774)
19
+ - (void)detachFromView:(RCTUIView *)view; // TODO(macOS GH#774)
20
20
 
21
21
  /*
22
22
  * Offset of the attached view relative to the root component in points.