react-native-windows 0.77.0 → 0.78.0-preview.2

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 (234) hide show
  1. package/.flowconfig +1 -1
  2. package/Chakra/ChakraTracing.cpp +1 -1
  3. package/Libraries/Animated/animations/Animation.js +22 -1
  4. package/Libraries/Animated/animations/DecayAnimation.js +1 -0
  5. package/Libraries/Animated/animations/SpringAnimation.js +1 -0
  6. package/Libraries/Animated/animations/TimingAnimation.js +1 -0
  7. package/Libraries/Animated/nodes/AnimatedAddition.js +9 -2
  8. package/Libraries/Animated/nodes/AnimatedColor.js +4 -1
  9. package/Libraries/Animated/nodes/AnimatedDiffClamp.js +10 -2
  10. package/Libraries/Animated/nodes/AnimatedDivision.js +9 -2
  11. package/Libraries/Animated/nodes/AnimatedInterpolation.js +5 -1
  12. package/Libraries/Animated/nodes/AnimatedModulo.js +5 -2
  13. package/Libraries/Animated/nodes/AnimatedMultiplication.js +9 -2
  14. package/Libraries/Animated/nodes/AnimatedNode.js +25 -46
  15. package/Libraries/Animated/nodes/AnimatedObject.js +9 -2
  16. package/Libraries/Animated/nodes/AnimatedProps.js +5 -1
  17. package/Libraries/Animated/nodes/AnimatedStyle.js +5 -1
  18. package/Libraries/Animated/nodes/AnimatedSubtraction.js +9 -2
  19. package/Libraries/Animated/nodes/AnimatedTracking.js +5 -1
  20. package/Libraries/Animated/nodes/AnimatedTransform.js +5 -1
  21. package/Libraries/Animated/nodes/AnimatedValue.js +49 -4
  22. package/Libraries/Animated/nodes/AnimatedValueXY.js +3 -1
  23. package/Libraries/Animated/useAnimatedProps.js +0 -43
  24. package/Libraries/Components/Button.windows.js +3 -0
  25. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.d.ts +1 -1
  26. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js +3 -1
  27. package/Libraries/Components/LayoutConformance/LayoutConformance.d.ts +21 -0
  28. package/Libraries/Components/LayoutConformance/LayoutConformance.js +59 -0
  29. package/Libraries/Components/LayoutConformance/LayoutConformanceNativeComponent.js +29 -0
  30. package/Libraries/Components/Pressable/Pressable.windows.js +3 -0
  31. package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +1 -0
  32. package/Libraries/Components/TextInput/TextInput.d.ts +5 -0
  33. package/Libraries/Components/TextInput/TextInput.flow.js +6 -0
  34. package/Libraries/Components/TextInput/TextInput.js +6 -0
  35. package/Libraries/Components/TextInput/TextInput.windows.js +9 -0
  36. package/Libraries/Components/Touchable/TouchableBounce.windows.js +2 -0
  37. package/Libraries/Components/Touchable/TouchableNativeFeedback.windows.js +2 -0
  38. package/Libraries/Components/Touchable/TouchableOpacity.windows.js +2 -0
  39. package/Libraries/Components/Touchable/TouchableWithoutFeedback.windows.js +2 -0
  40. package/Libraries/Components/View/View.windows.js +3 -0
  41. package/Libraries/Components/View/ViewAccessibility.d.ts +7 -2
  42. package/Libraries/Components/View/ViewAccessibility.windows.js +1 -0
  43. package/Libraries/Components/View/ViewPropTypes.d.ts +0 -7
  44. package/Libraries/Components/View/ViewPropTypes.js +0 -9
  45. package/Libraries/Components/View/ViewPropTypes.windows.js +1 -9
  46. package/Libraries/Core/ReactNativeVersion.js +2 -2
  47. package/Libraries/Core/setUpBatchedBridge.js +1 -16
  48. package/Libraries/EventEmitter/RCTEventEmitter.js +2 -6
  49. package/Libraries/Image/AssetSourceResolver.js +11 -0
  50. package/Libraries/Image/AssetSourceResolver.windows.js +11 -0
  51. package/Libraries/Image/Image.windows.js +2 -0
  52. package/Libraries/Inspector/BorderBox.js +26 -14
  53. package/Libraries/Inspector/BoxInspector.js +60 -42
  54. package/Libraries/Inspector/ElementBox.js +55 -48
  55. package/Libraries/Inspector/StyleInspector.js +36 -30
  56. package/Libraries/LayoutAnimation/LayoutAnimation.js +2 -2
  57. package/Libraries/Lists/FlatList.d.ts +1 -1
  58. package/Libraries/Modal/Modal.js +2 -0
  59. package/Libraries/Modal/Modal.windows.js +2 -0
  60. package/Libraries/NativeComponent/BaseViewConfig.android.js +0 -2
  61. package/Libraries/NativeComponent/BaseViewConfig.ios.js +0 -2
  62. package/Libraries/NativeComponent/BaseViewConfig.windows.js +0 -2
  63. package/Libraries/Network/RCTNetworking.android.js +24 -16
  64. package/Libraries/Network/RCTNetworking.ios.js +1 -46
  65. package/Libraries/Network/RCTNetworking.windows.js +1 -46
  66. package/Libraries/Network/RCTNetworkingEventDefinitions.flow.js +57 -0
  67. package/Libraries/ReactNative/UIManagerProperties.js +3 -1
  68. package/Libraries/Renderer/implementations/ReactFabric-dev.js +15828 -26461
  69. package/Libraries/Renderer/implementations/ReactFabric-prod.js +3907 -2560
  70. package/Libraries/Renderer/implementations/ReactFabric-profiling.js +4399 -2878
  71. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +16102 -26908
  72. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +4034 -2695
  73. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +4535 -3045
  74. package/Libraries/Renderer/shims/ReactNativeTypes.js +5 -6
  75. package/Libraries/StyleSheet/processTransform.js +6 -0
  76. package/Libraries/Text/Text.d.ts +6 -1
  77. package/Libraries/Text/Text.windows.js +4 -0
  78. package/Libraries/Text/TextProps.js +2 -2
  79. package/Libraries/Text/TextProps.windows.js +3 -2
  80. package/Libraries/Utilities/BackHandler.android.js +5 -4
  81. package/Libraries/Utilities/BackHandler.ios.js +4 -5
  82. package/Libraries/Utilities/BackHandler.windows.js +5 -4
  83. package/Microsoft.ReactNative/CompositionComponentView.idl +13 -1
  84. package/Microsoft.ReactNative/Fabric/ComponentView.cpp +0 -1
  85. package/Microsoft.ReactNative/Fabric/Composition/ComponentViewRegistry.cpp +0 -5
  86. package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +92 -17
  87. package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.h +9 -0
  88. package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +13 -33
  89. package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.h +1 -3
  90. package/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.cpp +43 -5
  91. package/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.h +2 -1
  92. package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +12 -10
  93. package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp +11 -9
  94. package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h +1 -1
  95. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +191 -329
  96. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.h +3 -61
  97. package/Microsoft.ReactNative/Fabric/Composition/PortalComponentView.cpp +66 -0
  98. package/Microsoft.ReactNative/Fabric/Composition/PortalComponentView.h +52 -0
  99. package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.cpp +21 -0
  100. package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.h +7 -4
  101. package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +79 -19
  102. package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +12 -6
  103. package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp +71 -17
  104. package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.h +16 -0
  105. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentDescriptor.h +5 -10
  106. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +4 -4
  107. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.cpp +138 -110
  108. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.h +27 -27
  109. package/Microsoft.ReactNative/Fabric/Composition/Theme.cpp +1 -1
  110. package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp +38 -33
  111. package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.h +0 -2
  112. package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +5 -16
  113. package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.h +0 -3
  114. package/Microsoft.ReactNative/Fabric/ImageManager.cpp +9 -0
  115. package/Microsoft.ReactNative/Fabric/WindowsComponentDescriptorRegistry.cpp +0 -2
  116. package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/PlatformColorUtils.cpp +1 -1
  117. package/Microsoft.ReactNative/IReactCompositionViewComponentBuilder.idl +5 -0
  118. package/Microsoft.ReactNative/IReactContext.cpp +2 -2
  119. package/Microsoft.ReactNative/IReactContext.h +1 -1
  120. package/Microsoft.ReactNative/IReactContext.idl +2 -2
  121. package/Microsoft.ReactNative/IReactPackageBuilder.idl +3 -3
  122. package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +97 -87
  123. package/Microsoft.ReactNative/Modules/AccessibilityInfoModule.cpp +4 -0
  124. package/Microsoft.ReactNative/Modules/AlertModule.cpp +9 -4
  125. package/Microsoft.ReactNative/Modules/Animated/NativeAnimatedNodeManager.cpp +1 -1
  126. package/Microsoft.ReactNative/Modules/Animated/PropsAnimatedNode.cpp +32 -35
  127. package/Microsoft.ReactNative/Modules/Animated/PropsAnimatedNode.h +7 -4
  128. package/Microsoft.ReactNative/Modules/AppStateModule.cpp +1 -1
  129. package/Microsoft.ReactNative/Modules/AppThemeModuleUwp.cpp +2 -2
  130. package/Microsoft.ReactNative/Modules/AppearanceModule.cpp +2 -2
  131. package/Microsoft.ReactNative/Modules/DeviceInfoModule.cpp +3 -3
  132. package/Microsoft.ReactNative/Modules/I18nManagerModule.cpp +1 -1
  133. package/Microsoft.ReactNative/Modules/LogBoxModule.cpp +7 -5
  134. package/Microsoft.ReactNative/Modules/LogBoxModule.h +2 -1
  135. package/Microsoft.ReactNative/Modules/NativeUIManager.cpp +10 -10
  136. package/Microsoft.ReactNative/Modules/PaperUIManagerModule.cpp +24 -24
  137. package/Microsoft.ReactNative/Modules/Timing.cpp +2 -2
  138. package/Microsoft.ReactNative/ReactHost/IReactInstance.h +5 -0
  139. package/Microsoft.ReactNative/ReactHost/React.h +0 -3
  140. package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +39 -16
  141. package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.h +4 -2
  142. package/Microsoft.ReactNative/ReactNativeHost.cpp +9 -4
  143. package/Microsoft.ReactNative/ReactNativeIsland.idl +5 -1
  144. package/Microsoft.ReactNative/ReactPackageBuilder.cpp +3 -3
  145. package/Microsoft.ReactNative/ReactPackageBuilder.h +4 -4
  146. package/Microsoft.ReactNative/Utils/Helpers.cpp +0 -2
  147. package/Microsoft.ReactNative/Views/DebuggingOverlayViewManager.cpp +0 -1
  148. package/Microsoft.ReactNative/Views/DevMenu.cpp +6 -6
  149. package/Microsoft.ReactNative/Views/DevMenu.h +1 -1
  150. package/Microsoft.ReactNative/Views/ViewManagerBase.cpp +2 -2
  151. package/Microsoft.ReactNative/Views/ViewPanel.cpp +1 -1
  152. package/Microsoft.ReactNative/Views/ViewViewManager.cpp +2 -2
  153. package/Microsoft.ReactNative/XamlUIService.cpp +13 -7
  154. package/Microsoft.ReactNative/XamlUIService.h +4 -1
  155. package/Microsoft.ReactNative/XamlUIService.idl +2 -0
  156. package/Microsoft.ReactNative.Cxx/JSI/JsiAbiApi.h +6 -2
  157. package/Microsoft.ReactNative.Cxx/ReactContext.h +1 -1
  158. package/Microsoft.ReactNative.Cxx/XamlUtils.h +12 -0
  159. package/PropertySheets/Generated/PackageVersion.g.props +3 -3
  160. package/PropertySheets/React.Cpp.props +3 -0
  161. package/PropertySheets/WebView2.props +1 -1
  162. package/PropertySheets/WinUI.props +5 -4
  163. package/ReactCommon/ReactCommon.vcxproj +5 -1
  164. package/ReactCommon/ReactCommon.vcxproj.filters +1 -1
  165. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/JSExecutor.cpp +3 -3
  166. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/NativeToJsBridge.cpp +3 -3
  167. package/ReactCommon/TEMP_UntilReactCommonUpdate/jsi/jsi/test/testlib.cpp +91 -0
  168. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/componentregistry/ComponentDescriptorRegistry.cpp +1 -12
  169. package/{Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputState.h → ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/textinput/TextInputState.h} +37 -35
  170. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/AccessibilityPrimitives.h +1 -0
  171. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/accessibilityPropsConversions.h +4 -0
  172. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/imagemanager/ImageRequestParams.h +30 -0
  173. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/runtimescheduler/SchedulerPriorityUtils.h +4 -3
  174. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/uimanager/primitives.h +179 -0
  175. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/runtime/ReactInstance.cpp +43 -57
  176. package/Shared/HermesRuntimeHolder.cpp +2 -2
  177. package/Shared/Shared.vcxitems +8 -14
  178. package/Shared/Shared.vcxitems.filters +4 -16
  179. package/Shared/Threading/BatchingQueueThread.cpp +3 -3
  180. package/codegen/NativeCPUTimeSpec.g.h +41 -0
  181. package/codegen/NativeFantomSpec.g.h +78 -0
  182. package/codegen/NativePerformanceSpec.g.h +31 -43
  183. package/codegen/NativeReactNativeFeatureFlagsSpec.g.h +84 -84
  184. package/codegen/react/components/rnwcore/ActivityIndicatorView.g.h +212 -0
  185. package/codegen/react/components/rnwcore/AndroidDrawerLayout.g.h +295 -0
  186. package/codegen/react/components/rnwcore/AndroidHorizontalScrollContentView.g.h +200 -0
  187. package/codegen/react/components/rnwcore/AndroidProgressBar.g.h +224 -0
  188. package/codegen/react/components/rnwcore/AndroidSwipeRefreshLayout.g.h +250 -0
  189. package/codegen/react/components/rnwcore/AndroidSwitch.g.h +267 -0
  190. package/codegen/react/components/rnwcore/DebuggingOverlay.g.h +234 -0
  191. package/codegen/react/components/rnwcore/InputAccessory.g.h +200 -0
  192. package/codegen/react/components/rnwcore/ModalHostView.g.h +283 -0
  193. package/codegen/react/components/rnwcore/PullToRefreshView.g.h +246 -0
  194. package/codegen/react/components/rnwcore/SafeAreaView.g.h +197 -0
  195. package/codegen/react/components/rnwcore/Switch.g.h +263 -0
  196. package/codegen/react/components/rnwcore/UnimplementedNativeView.g.h +200 -0
  197. package/codegen/rnwcoreJSI-generated.cpp +90 -57
  198. package/codegen/rnwcoreJSI.h +241 -104
  199. package/index.js +5 -0
  200. package/index.windows.js +5 -0
  201. package/just-task.js +1 -1
  202. package/package.json +25 -26
  203. package/src/private/animated/NativeAnimatedValidation.js +1 -1
  204. package/src/private/featureflags/ReactNativeFeatureFlags.js +33 -27
  205. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +5 -5
  206. package/src/private/renderer/errorhandling/ErrorHandlers.js +12 -55
  207. package/src/private/specs/modules/{NativeJSCSamplingProfiler.js → NativeCPUTime.js} +7 -2
  208. package/src/private/specs/modules/NativeFantom.js +37 -0
  209. package/src/private/utilities/ensureInstance.js +21 -0
  210. package/src/private/webapis/dom/nodes/ReactNativeElement.js +49 -6
  211. package/src/private/webapis/dom/nodes/ReadOnlyNode.js +17 -9
  212. package/src/private/webapis/intersectionobserver/IntersectionObserver.js +11 -11
  213. package/src/private/webapis/intersectionobserver/IntersectionObserverEntry.js +1 -1
  214. package/src/private/webapis/intersectionobserver/IntersectionObserverManager.js +1 -1
  215. package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +1 -0
  216. package/src/private/webapis/performance/Performance.js +0 -12
  217. package/src/private/webapis/performance/specs/NativePerformance.js +0 -11
  218. package/types/index.d.ts +1 -0
  219. package/Libraries/HeapCapture/HeapCapture.js +0 -29
  220. package/Libraries/HeapCapture/NativeJSCHeapCapture.js +0 -13
  221. package/Libraries/Performance/NativeJSCSamplingProfiler.js +0 -13
  222. package/Libraries/Performance/SamplingProfiler.js +0 -39
  223. package/Libraries/ReactNative/__mocks__/FabricUIManager.js +0 -334
  224. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentDescriptor.h +0 -39
  225. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewShadowNode.cpp +0 -18
  226. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewShadowNode.h +0 -39
  227. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputState.cpp +0 -34
  228. package/Microsoft.ReactNative/Fabric/ReactNativeConfigProperties.cpp +0 -53
  229. package/Microsoft.ReactNative/Fabric/ReactNativeConfigProperties.h +0 -26
  230. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/LayoutableShadowNode.cpp +0 -363
  231. package/codegen/NativeJSCSamplingProfilerSpec.g.h +0 -35
  232. package/src/private/webapis/dom/nodes/specs/__mocks__/NativeDOMMock.js +0 -413
  233. package/src/private/webapis/intersectionobserver/specs/__mocks__/NativeIntersectionObserver.js +0 -181
  234. package/src/private/webapis/mutationobserver/specs/__mocks__/NativeMutationObserver.js +0 -327
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @generated SignedSource<<aa51de14d1f085127ad410580beb15f6>>
7
+ * @generated SignedSource<<3037cf1c938dae492b656333cec9633c>>
8
8
  * @flow strict
9
9
  */
10
10
 
@@ -26,7 +26,7 @@ import {
26
26
  setOverrides,
27
27
  } from './ReactNativeFeatureFlagsBase';
28
28
 
29
- export type ReactNativeFeatureFlagsJsOnly = {
29
+ export type ReactNativeFeatureFlagsJsOnly = $ReadOnly<{
30
30
  jsOnlyTestFlag: Getter<boolean>,
31
31
  animatedShouldDebounceQueueFlush: Getter<boolean>,
32
32
  animatedShouldUseSingleOp: Getter<boolean>,
@@ -36,6 +36,7 @@ export type ReactNativeFeatureFlagsJsOnly = {
36
36
  enableAnimatedAllowlist: Getter<boolean>,
37
37
  enableAnimatedClearImmediateFix: Getter<boolean>,
38
38
  enableAnimatedPropsMemo: Getter<boolean>,
39
+ fixVirtualizeListCollapseWindowSize: Getter<boolean>,
39
40
  isLayoutAnimationEnabled: Getter<boolean>,
40
41
  shouldSkipStateUpdatesForLoopingAnimations: Getter<boolean>,
41
42
  shouldUseAnimatedObjectForTransform: Getter<boolean>,
@@ -43,19 +44,18 @@ export type ReactNativeFeatureFlagsJsOnly = {
43
44
  shouldUseSetNativePropsInFabric: Getter<boolean>,
44
45
  useInsertionEffectsForAnimations: Getter<boolean>,
45
46
  useRefsForTextInputState: Getter<boolean>,
46
- };
47
+ }>;
47
48
 
48
49
  export type ReactNativeFeatureFlagsJsOnlyOverrides = OverridesFor<ReactNativeFeatureFlagsJsOnly>;
49
50
 
50
- export type ReactNativeFeatureFlags = {
51
+ export type ReactNativeFeatureFlags = $ReadOnly<{
51
52
  ...ReactNativeFeatureFlagsJsOnly,
52
53
  commonTestFlag: Getter<boolean>,
53
54
  commonTestFlagWithoutNativeImplementation: Getter<boolean>,
54
55
  completeReactInstanceCreationOnBgThreadOnAndroid: Getter<boolean>,
55
56
  disableEventLoopOnBridgeless: Getter<boolean>,
56
57
  disableMountItemReorderingAndroid: Getter<boolean>,
57
- enableAlignItemsBaselineOnFabricIOS: Getter<boolean>,
58
- enableAndroidLineHeightCentering: Getter<boolean>,
58
+ enableAccumulatedUpdatesInRawPropsAndroid: Getter<boolean>,
59
59
  enableBridgelessArchitecture: Getter<boolean>,
60
60
  enableCppPropsIteratorSetter: Getter<boolean>,
61
61
  enableDeletionOfUnmountedViews: Getter<boolean>,
@@ -63,10 +63,10 @@ export type ReactNativeFeatureFlags = {
63
63
  enableEventEmitterRetentionDuringGesturesOnAndroid: Getter<boolean>,
64
64
  enableFabricLogs: Getter<boolean>,
65
65
  enableFabricRenderer: Getter<boolean>,
66
- enableFabricRendererExclusively: Getter<boolean>,
67
66
  enableFixForViewCommandRace: Getter<boolean>,
68
67
  enableGranularShadowTreeStateReconciliation: Getter<boolean>,
69
68
  enableIOSViewClipToPaddingBox: Getter<boolean>,
69
+ enableImagePrefetchingAndroid: Getter<boolean>,
70
70
  enableLayoutAnimationsOnAndroid: Getter<boolean>,
71
71
  enableLayoutAnimationsOnIOS: Getter<boolean>,
72
72
  enableLongTaskAPI: Getter<boolean>,
@@ -78,9 +78,9 @@ export type ReactNativeFeatureFlags = {
78
78
  enableUIConsistency: Getter<boolean>,
79
79
  enableViewRecycling: Getter<boolean>,
80
80
  excludeYogaFromRawProps: Getter<boolean>,
81
+ fixDifferentiatorEmittingUpdatesWithWrongParentTag: Getter<boolean>,
81
82
  fixMappingOfEventPrioritiesBetweenFabricAndReact: Getter<boolean>,
82
83
  fixMountingCoordinatorReportedPendingTransactionsOnAndroid: Getter<boolean>,
83
- fuseboxEnabledDebug: Getter<boolean>,
84
84
  fuseboxEnabledRelease: Getter<boolean>,
85
85
  initEagerTurboModulesOnNativeModulesQueueAndroid: Getter<boolean>,
86
86
  lazyAnimationCallbacks: Getter<boolean>,
@@ -92,10 +92,11 @@ export type ReactNativeFeatureFlags = {
92
92
  useNativeViewConfigsInBridgelessMode: Getter<boolean>,
93
93
  useOptimisedViewPreallocationOnAndroid: Getter<boolean>,
94
94
  useOptimizedEventBatchingOnAndroid: Getter<boolean>,
95
+ useRawPropsJsiValue: Getter<boolean>,
95
96
  useRuntimeShadowNodeReferenceUpdate: Getter<boolean>,
96
97
  useTurboModuleInterop: Getter<boolean>,
97
98
  useTurboModules: Getter<boolean>,
98
- }
99
+ }>;
99
100
 
100
101
  /**
101
102
  * JS-only flag for testing. Do NOT modify.
@@ -142,6 +143,11 @@ export const enableAnimatedClearImmediateFix: Getter<boolean> = createJavaScript
142
143
  */
143
144
  export const enableAnimatedPropsMemo: Getter<boolean> = createJavaScriptFlagGetter('enableAnimatedPropsMemo', true);
144
145
 
146
+ /**
147
+ * Fixing an edge case where the current window size is not properly calculated with fast scrolling. Window size collapsed to 1 element even if windowSize more than the current amount of elements
148
+ */
149
+ export const fixVirtualizeListCollapseWindowSize: Getter<boolean> = createJavaScriptFlagGetter('fixVirtualizeListCollapseWindowSize', false);
150
+
145
151
  /**
146
152
  * Function used to enable / disabled Layout Animations in React Native.
147
153
  */
@@ -150,7 +156,7 @@ export const isLayoutAnimationEnabled: Getter<boolean> = createJavaScriptFlagGet
150
156
  /**
151
157
  * If the animation is within Animated.loop, we do not send state updates to React.
152
158
  */
153
- export const shouldSkipStateUpdatesForLoopingAnimations: Getter<boolean> = createJavaScriptFlagGetter('shouldSkipStateUpdatesForLoopingAnimations', false);
159
+ export const shouldSkipStateUpdatesForLoopingAnimations: Getter<boolean> = createJavaScriptFlagGetter('shouldSkipStateUpdatesForLoopingAnimations', true);
154
160
 
155
161
  /**
156
162
  * Enables use of AnimatedObject for animating transform values.
@@ -170,7 +176,7 @@ export const shouldUseSetNativePropsInFabric: Getter<boolean> = createJavaScript
170
176
  /**
171
177
  * Changes construction of the animation graph to `useInsertionEffect` instead of `useLayoutEffect`.
172
178
  */
173
- export const useInsertionEffectsForAnimations: Getter<boolean> = createJavaScriptFlagGetter('useInsertionEffectsForAnimations', false);
179
+ export const useInsertionEffectsForAnimations: Getter<boolean> = createJavaScriptFlagGetter('useInsertionEffectsForAnimations', true);
174
180
 
175
181
  /**
176
182
  * Enable a variant of TextInput that moves some state to refs to avoid unnecessary re-renders
@@ -198,13 +204,9 @@ export const disableEventLoopOnBridgeless: Getter<boolean> = createNativeFlagGet
198
204
  */
199
205
  export const disableMountItemReorderingAndroid: Getter<boolean> = createNativeFlagGetter('disableMountItemReorderingAndroid', false);
200
206
  /**
201
- * Kill-switch to turn off support for aling-items:baseline on Fabric iOS.
202
- */
203
- export const enableAlignItemsBaselineOnFabricIOS: Getter<boolean> = createNativeFlagGetter('enableAlignItemsBaselineOnFabricIOS', true);
204
- /**
205
- * When enabled, custom line height calculation will be centered from top to bottom.
207
+ * When enabled, Andoid will accumulate updates in rawProps to reduce the number of mounting instructions for cascading rerenders.
206
208
  */
207
- export const enableAndroidLineHeightCentering: Getter<boolean> = createNativeFlagGetter('enableAndroidLineHeightCentering', true);
209
+ export const enableAccumulatedUpdatesInRawPropsAndroid: Getter<boolean> = createNativeFlagGetter('enableAccumulatedUpdatesInRawPropsAndroid', false);
208
210
  /**
209
211
  * Feature flag to enable the new bridgeless architecture. Note: Enabling this will force enable the following flags: `useTurboModules` & `enableFabricRenderer.
210
212
  */
@@ -233,10 +235,6 @@ export const enableFabricLogs: Getter<boolean> = createNativeFlagGetter('enableF
233
235
  * Enables the use of the Fabric renderer in the whole app.
234
236
  */
235
237
  export const enableFabricRenderer: Getter<boolean> = createNativeFlagGetter('enableFabricRenderer', false);
236
- /**
237
- * When the app is completely migrated to Fabric, set this flag to true to disable parts of Paper infrastructure that are not needed anymore but consume memory and CPU. Specifically, UIViewOperationQueue and EventDispatcherImpl will no longer work as they will not subscribe to ReactChoreographer for updates.
238
- */
239
- export const enableFabricRendererExclusively: Getter<boolean> = createNativeFlagGetter('enableFabricRendererExclusively', false);
240
238
  /**
241
239
  * Synchronise the view command dispatching with mounting of new transaction
242
240
  */
@@ -249,6 +247,10 @@ export const enableGranularShadowTreeStateReconciliation: Getter<boolean> = crea
249
247
  * iOS Views will clip to their padding box vs border box
250
248
  */
251
249
  export const enableIOSViewClipToPaddingBox: Getter<boolean> = createNativeFlagGetter('enableIOSViewClipToPaddingBox', false);
250
+ /**
251
+ * When enabled, Andoid will build and initiate image prefetch requests on ImageShadowNode::layout
252
+ */
253
+ export const enableImagePrefetchingAndroid: Getter<boolean> = createNativeFlagGetter('enableImagePrefetchingAndroid', false);
252
254
  /**
253
255
  * When enabled, LayoutAnimations API will animate state changes on Android.
254
256
  */
@@ -293,6 +295,10 @@ export const enableViewRecycling: Getter<boolean> = createNativeFlagGetter('enab
293
295
  * When enabled, rawProps in Props will not include Yoga specific props.
294
296
  */
295
297
  export const excludeYogaFromRawProps: Getter<boolean> = createNativeFlagGetter('excludeYogaFromRawProps', false);
298
+ /**
299
+ * Fixes a bug in Differentiator where parent views may be referenced before they're created
300
+ */
301
+ export const fixDifferentiatorEmittingUpdatesWithWrongParentTag: Getter<boolean> = createNativeFlagGetter('fixDifferentiatorEmittingUpdatesWithWrongParentTag', true);
296
302
  /**
297
303
  * Uses the default event priority instead of the discreet event priority by default when dispatching events from Fabric to React.
298
304
  */
@@ -301,10 +307,6 @@ export const fixMappingOfEventPrioritiesBetweenFabricAndReact: Getter<boolean> =
301
307
  * Fixes a limitation on Android where the mounting coordinator would report there are no pending transactions but some of them were actually not processed due to the use of the push model.
302
308
  */
303
309
  export const fixMountingCoordinatorReportedPendingTransactionsOnAndroid: Getter<boolean> = createNativeFlagGetter('fixMountingCoordinatorReportedPendingTransactionsOnAndroid', false);
304
- /**
305
- * Flag determining if the React Native DevTools (Fusebox) CDP backend should be enabled in debug builds. This flag is global and should not be changed across React Host lifetimes.
306
- */
307
- export const fuseboxEnabledDebug: Getter<boolean> = createNativeFlagGetter('fuseboxEnabledDebug', true);
308
310
  /**
309
311
  * Flag determining if the React Native DevTools (Fusebox) CDP backend should be enabled in release builds. This flag is global and should not be changed across React Host lifetimes.
310
312
  */
@@ -320,7 +322,7 @@ export const lazyAnimationCallbacks: Getter<boolean> = createNativeFlagGetter('l
320
322
  /**
321
323
  * Adds support for loading vector drawable assets in the Image component (only on Android)
322
324
  */
323
- export const loadVectorDrawablesOnImages: Getter<boolean> = createNativeFlagGetter('loadVectorDrawablesOnImages', false);
325
+ export const loadVectorDrawablesOnImages: Getter<boolean> = createNativeFlagGetter('loadVectorDrawablesOnImages', true);
324
326
  /**
325
327
  * Enables storing js caller stack when creating promise in native module. This is useful in case of Promise rejection and tracing the cause.
326
328
  */
@@ -349,10 +351,14 @@ export const useOptimisedViewPreallocationOnAndroid: Getter<boolean> = createNat
349
351
  * Uses an optimized mechanism for event batching on Android that does not need to wait for a Choreographer frame callback.
350
352
  */
351
353
  export const useOptimizedEventBatchingOnAndroid: Getter<boolean> = createNativeFlagGetter('useOptimizedEventBatchingOnAndroid', false);
354
+ /**
355
+ * Instead of using folly::dynamic as internal representation in RawProps and RawValue, use jsi::Value
356
+ */
357
+ export const useRawPropsJsiValue: Getter<boolean> = createNativeFlagGetter('useRawPropsJsiValue', false);
352
358
  /**
353
359
  * When enabled, cloning shadow nodes within react native will update the reference held by the current JS fiber tree.
354
360
  */
355
- export const useRuntimeShadowNodeReferenceUpdate: Getter<boolean> = createNativeFlagGetter('useRuntimeShadowNodeReferenceUpdate', false);
361
+ export const useRuntimeShadowNodeReferenceUpdate: Getter<boolean> = createNativeFlagGetter('useRuntimeShadowNodeReferenceUpdate', true);
356
362
  /**
357
363
  * In Bridgeless mode, should legacy NativeModules use the TurboModule system?
358
364
  */
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @generated SignedSource<<4caaf5dbaa68614ce53c8aecbd512df8>>
7
+ * @generated SignedSource<<37e95652ef5d824bb05e78ebdb051e43>>
8
8
  * @flow strict
9
9
  */
10
10
 
@@ -28,8 +28,7 @@ export interface Spec extends TurboModule {
28
28
  +completeReactInstanceCreationOnBgThreadOnAndroid?: () => boolean;
29
29
  +disableEventLoopOnBridgeless?: () => boolean;
30
30
  +disableMountItemReorderingAndroid?: () => boolean;
31
- +enableAlignItemsBaselineOnFabricIOS?: () => boolean;
32
- +enableAndroidLineHeightCentering?: () => boolean;
31
+ +enableAccumulatedUpdatesInRawPropsAndroid?: () => boolean;
33
32
  +enableBridgelessArchitecture?: () => boolean;
34
33
  +enableCppPropsIteratorSetter?: () => boolean;
35
34
  +enableDeletionOfUnmountedViews?: () => boolean;
@@ -37,10 +36,10 @@ export interface Spec extends TurboModule {
37
36
  +enableEventEmitterRetentionDuringGesturesOnAndroid?: () => boolean;
38
37
  +enableFabricLogs?: () => boolean;
39
38
  +enableFabricRenderer?: () => boolean;
40
- +enableFabricRendererExclusively?: () => boolean;
41
39
  +enableFixForViewCommandRace?: () => boolean;
42
40
  +enableGranularShadowTreeStateReconciliation?: () => boolean;
43
41
  +enableIOSViewClipToPaddingBox?: () => boolean;
42
+ +enableImagePrefetchingAndroid?: () => boolean;
44
43
  +enableLayoutAnimationsOnAndroid?: () => boolean;
45
44
  +enableLayoutAnimationsOnIOS?: () => boolean;
46
45
  +enableLongTaskAPI?: () => boolean;
@@ -52,9 +51,9 @@ export interface Spec extends TurboModule {
52
51
  +enableUIConsistency?: () => boolean;
53
52
  +enableViewRecycling?: () => boolean;
54
53
  +excludeYogaFromRawProps?: () => boolean;
54
+ +fixDifferentiatorEmittingUpdatesWithWrongParentTag?: () => boolean;
55
55
  +fixMappingOfEventPrioritiesBetweenFabricAndReact?: () => boolean;
56
56
  +fixMountingCoordinatorReportedPendingTransactionsOnAndroid?: () => boolean;
57
- +fuseboxEnabledDebug?: () => boolean;
58
57
  +fuseboxEnabledRelease?: () => boolean;
59
58
  +initEagerTurboModulesOnNativeModulesQueueAndroid?: () => boolean;
60
59
  +lazyAnimationCallbacks?: () => boolean;
@@ -66,6 +65,7 @@ export interface Spec extends TurboModule {
66
65
  +useNativeViewConfigsInBridgelessMode?: () => boolean;
67
66
  +useOptimisedViewPreallocationOnAndroid?: () => boolean;
68
67
  +useOptimizedEventBatchingOnAndroid?: () => boolean;
68
+ +useRawPropsJsiValue?: () => boolean;
69
69
  +useRuntimeShadowNodeReferenceUpdate?: () => boolean;
70
70
  +useTurboModuleInterop?: () => boolean;
71
71
  +useTurboModules?: () => boolean;
@@ -21,7 +21,10 @@ type ErrorInfo = {
21
21
  +errorBoundary?: ?React$Component<any, any>,
22
22
  };
23
23
 
24
- export function onUncaughtError(errorValue: mixed, errorInfo: ErrorInfo): void {
24
+ function getExtendedError(
25
+ errorValue: mixed,
26
+ errorInfo: ErrorInfo,
27
+ ): ExtendedError {
25
28
  let error;
26
29
 
27
30
  // Typically, `errorValue` should be an error. However, other values such as
@@ -50,38 +53,18 @@ export function onUncaughtError(errorValue: mixed, errorInfo: ErrorInfo): void {
50
53
  // Ignored.
51
54
  }
52
55
 
56
+ return error;
57
+ }
58
+
59
+ export function onUncaughtError(errorValue: mixed, errorInfo: ErrorInfo): void {
60
+ const error = getExtendedError(errorValue, errorInfo);
61
+
53
62
  // Uncaught errors are fatal.
54
63
  handleException(error, true);
55
64
  }
56
65
 
57
66
  export function onCaughtError(errorValue: mixed, errorInfo: ErrorInfo): void {
58
- let error;
59
-
60
- // Typically, `errorValue` should be an error. However, other values such as
61
- // strings (or even null) are sometimes thrown.
62
- if (errorValue instanceof Error) {
63
- /* $FlowFixMe[class-object-subtyping] added when improving typing for
64
- * this parameters */
65
- // $FlowFixMe[incompatible-cast]
66
- error = (errorValue: ExtendedError);
67
- } else if (typeof errorValue === 'string') {
68
- /* $FlowFixMe[class-object-subtyping] added when improving typing for
69
- * this parameters */
70
- // $FlowFixMe[incompatible-cast]
71
- error = (new SyntheticError(errorValue): ExtendedError);
72
- } else {
73
- /* $FlowFixMe[class-object-subtyping] added when improving typing for
74
- * this parameters */
75
- // $FlowFixMe[incompatible-cast]
76
- error = (new SyntheticError('Unspecified error'): ExtendedError);
77
- }
78
- try {
79
- // $FlowFixMe[incompatible-use] this is in try/catch.
80
- error.componentStack = errorInfo.componentStack;
81
- error.isComponentError = true;
82
- } catch {
83
- // Ignored.
84
- }
67
+ const error = getExtendedError(errorValue, errorInfo);
85
68
 
86
69
  // Caught errors are not fatal.
87
70
  handleException(error, false);
@@ -91,33 +74,7 @@ export function onRecoverableError(
91
74
  errorValue: mixed,
92
75
  errorInfo: ErrorInfo,
93
76
  ): void {
94
- let error;
95
-
96
- // Typically, `errorValue` should be an error. However, other values such as
97
- // strings (or even null) are sometimes thrown.
98
- if (errorValue instanceof Error) {
99
- /* $FlowFixMe[class-object-subtyping] added when improving typing for
100
- * this parameters */
101
- // $FlowFixMe[incompatible-cast]
102
- error = (errorValue: ExtendedError);
103
- } else if (typeof errorValue === 'string') {
104
- /* $FlowFixMe[class-object-subtyping] added when improving typing for
105
- * this parameters */
106
- // $FlowFixMe[incompatible-cast]
107
- error = (new SyntheticError(errorValue): ExtendedError);
108
- } else {
109
- /* $FlowFixMe[class-object-subtyping] added when improving typing for
110
- * this parameters */
111
- // $FlowFixMe[incompatible-cast]
112
- error = (new SyntheticError('Unspecified error'): ExtendedError);
113
- }
114
- try {
115
- // $FlowFixMe[incompatible-use] this is in try/catch.
116
- error.componentStack = errorInfo.componentStack;
117
- error.isComponentError = true;
118
- } catch {
119
- // Ignored.
120
- }
77
+ const error = getExtendedError(errorValue, errorInfo);
121
78
 
122
79
  // Recoverable errors should only be warnings.
123
80
  // This will make it a soft error in LogBox.
@@ -12,8 +12,13 @@ import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport';
12
12
 
13
13
  import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry';
14
14
 
15
+ /**
16
+ * This is an internal native module meant to be used for performance
17
+ * measurements and benchmarks. It is not meant to be used in production.
18
+ */
15
19
  export interface Spec extends TurboModule {
16
- +operationComplete: (token: number, result: ?string, error: ?string) => void;
20
+ +getCPUTimeNanos: () => number;
21
+ +hasAccurateCPUTimeNanosForBenchmarks: () => boolean;
17
22
  }
18
23
 
19
- export default (TurboModuleRegistry.get<Spec>('JSCSamplingProfiler'): ?Spec);
24
+ export default (TurboModuleRegistry.getEnforcing<Spec>('CPUTimeCxx'): Spec);
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow strict
8
+ * @format
9
+ */
10
+
11
+ import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport';
12
+
13
+ import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry';
14
+
15
+ // match RenderFormatOptions.h
16
+ export type RenderFormatOptions = {
17
+ includeRoot: boolean,
18
+ includeLayoutMetrics: boolean,
19
+ };
20
+
21
+ interface Spec extends TurboModule {
22
+ startSurface: (
23
+ surfaceId: number,
24
+ viewportWidth: number,
25
+ viewportHeight: number,
26
+ devicePixelRatio: number,
27
+ ) => void;
28
+ stopSurface: (surfaceId: number) => void;
29
+ getMountingManagerLogs: (surfaceId: number) => Array<string>;
30
+ flushMessageQueue: () => void;
31
+ getRenderedOutput: (surfaceId: number, config: RenderFormatOptions) => string;
32
+ reportTestSuiteResultsJSON: (results: string) => void;
33
+ }
34
+
35
+ export default TurboModuleRegistry.getEnforcing<Spec>(
36
+ 'NativeFantomCxx',
37
+ ) as Spec;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @format
8
+ * @flow strict
9
+ */
10
+
11
+ export default function ensureInstance<T>(value: mixed, Class: Class<T>): T {
12
+ if (!(value instanceof Class)) {
13
+ // $FlowIssue[incompatible-use]
14
+ const className = Class.name;
15
+ throw new Error(
16
+ `Expected instance of ${className} but got ${String(value)}`,
17
+ );
18
+ }
19
+
20
+ return value;
21
+ }
@@ -25,7 +25,7 @@ import {getFabricUIManager} from '../../../../../Libraries/ReactNative/FabricUIM
25
25
  import {create as createAttributePayload} from '../../../../../Libraries/ReactNative/ReactFabricPublicInstance/ReactNativeAttributePayload';
26
26
  import warnForStyleProps from '../../../../../Libraries/ReactNative/ReactFabricPublicInstance/warnForStyleProps';
27
27
  import ReadOnlyElement, {getBoundingClientRect} from './ReadOnlyElement';
28
- import ReadOnlyNode from './ReadOnlyNode';
28
+ import ReadOnlyNode, {setInstanceHandle} from './ReadOnlyNode';
29
29
  import {
30
30
  getPublicInstanceFromInternalInstanceHandle,
31
31
  getShadowNode,
@@ -35,7 +35,26 @@ import nullthrows from 'nullthrows';
35
35
 
36
36
  const noop = () => {};
37
37
 
38
- export default class ReactNativeElement
38
+ // Ideally, this class would be exported as-is, but this implementation is
39
+ // significantly slower than the existing `ReactFabricHostComponent`.
40
+ // This is a very hot code path (this class is instantiated once per rendered
41
+ // host component in the tree) and we can't regress performance here.
42
+ //
43
+ // This implementation is slower because this is a subclass and we have to call
44
+ // super(), which is a very slow operation the way that Babel transforms it at
45
+ // the moment.
46
+ //
47
+ // The optimization we're doing is using an old-style function constructor,
48
+ // where we're not required to use `super()`, and we make that constructor
49
+ // extend this class so it inherits all the methods and it sets the class
50
+ // hierarchy correctly.
51
+ //
52
+ // An alternative implementation was to implement the constructor as a function
53
+ // returning a manually constructed instance using `Object.create()` but that
54
+ // was slower than this method because the engine has to create an object than
55
+ // we then discard to create a new one.
56
+
57
+ class ReactNativeElementMethods
39
58
  extends ReadOnlyElement
40
59
  implements INativeMethods
41
60
  {
@@ -43,8 +62,10 @@ export default class ReactNativeElement
43
62
  __nativeTag: number;
44
63
  __internalInstanceHandle: InternalInstanceHandle;
45
64
 
46
- #viewConfig: ViewConfig;
65
+ __viewConfig: ViewConfig;
47
66
 
67
+ // This constructor isn't really used. See the `ReactNativeElement` function
68
+ // below.
48
69
  constructor(
49
70
  tag: number,
50
71
  viewConfig: ViewConfig,
@@ -54,7 +75,7 @@ export default class ReactNativeElement
54
75
 
55
76
  this.__nativeTag = tag;
56
77
  this.__internalInstanceHandle = internalInstanceHandle;
57
- this.#viewConfig = viewConfig;
78
+ this.__viewConfig = viewConfig;
58
79
  }
59
80
 
60
81
  get offsetHeight(): number {
@@ -171,12 +192,12 @@ export default class ReactNativeElement
171
192
 
172
193
  setNativeProps(nativeProps: {...}): void {
173
194
  if (__DEV__) {
174
- warnForStyleProps(nativeProps, this.#viewConfig.validAttributes);
195
+ warnForStyleProps(nativeProps, this.__viewConfig.validAttributes);
175
196
  }
176
197
 
177
198
  const updatePayload = createAttributePayload(
178
199
  nativeProps,
179
- this.#viewConfig.validAttributes,
200
+ this.__viewConfig.validAttributes,
180
201
  );
181
202
 
182
203
  const node = getShadowNode(this);
@@ -186,3 +207,25 @@ export default class ReactNativeElement
186
207
  }
187
208
  }
188
209
  }
210
+
211
+ // Alternative constructor just implemented to provide a better performance than
212
+ // calling super() in the original class.
213
+ function ReactNativeElement(
214
+ this: ReactNativeElementMethods,
215
+ tag: number,
216
+ viewConfig: ViewConfig,
217
+ internalInstanceHandle: InternalInstanceHandle,
218
+ ) {
219
+ this.__nativeTag = tag;
220
+ this.__internalInstanceHandle = internalInstanceHandle;
221
+ this.__viewConfig = viewConfig;
222
+ setInstanceHandle(this, internalInstanceHandle);
223
+ }
224
+
225
+ ReactNativeElement.prototype = Object.create(
226
+ ReactNativeElementMethods.prototype,
227
+ );
228
+
229
+ // $FlowExpectedError[prop-missing]
230
+ // $FlowFixMe[incompatible-cast]
231
+ export default ReactNativeElement as typeof ReactNativeElementMethods;
@@ -26,6 +26,8 @@ let ReadOnlyElementClass: Class<ReadOnlyElement>;
26
26
 
27
27
  export default class ReadOnlyNode {
28
28
  constructor(internalInstanceHandle: InternalInstanceHandle) {
29
+ // This constructor is inlined in `ReactNativeElement` so if you modify
30
+ // this make sure that their implementation stays in sync.
29
31
  setInstanceHandle(this, internalInstanceHandle);
30
32
  }
31
33
 
@@ -293,7 +295,7 @@ export function getInstanceHandle(node: ReadOnlyNode): InternalInstanceHandle {
293
295
  return node[INSTANCE_HANDLE_KEY];
294
296
  }
295
297
 
296
- function setInstanceHandle(
298
+ export function setInstanceHandle(
297
299
  node: ReadOnlyNode,
298
300
  instanceHandle: InternalInstanceHandle,
299
301
  ): void {
@@ -301,11 +303,18 @@ function setInstanceHandle(
301
303
  node[INSTANCE_HANDLE_KEY] = instanceHandle;
302
304
  }
303
305
 
306
+ let RendererProxy;
307
+ function getRendererProxy() {
308
+ if (RendererProxy == null) {
309
+ // Lazy import Fabric here to avoid DOM Node APIs classes from having side-effects.
310
+ // With a static import we can't use these classes for Paper-only variants.
311
+ RendererProxy = require('../../../../../Libraries/ReactNative/RendererProxy');
312
+ }
313
+ return RendererProxy;
314
+ }
315
+
304
316
  export function getShadowNode(node: ReadOnlyNode): ?ShadowNode {
305
- // Lazy import Fabric here to avoid DOM Node APIs classes from having side-effects.
306
- // With a static import we can't use these classes for Paper-only variants.
307
- const RendererProxy = require('../../../../../Libraries/ReactNative/RendererProxy');
308
- return RendererProxy.getNodeFromInternalInstanceHandle(
317
+ return getRendererProxy().getNodeFromInternalInstanceHandle(
309
318
  getInstanceHandle(node),
310
319
  );
311
320
  }
@@ -349,11 +358,10 @@ function getNodeSiblingsAndPosition(
349
358
  export function getPublicInstanceFromInternalInstanceHandle(
350
359
  instanceHandle: InternalInstanceHandle,
351
360
  ): ?ReadOnlyNode {
352
- // Lazy import Fabric here to avoid DOM Node APIs classes from having side-effects.
353
- // With a static import we can't use these classes for Paper-only variants.
354
- const RendererProxy = require('../../../../../Libraries/ReactNative/RendererProxy');
355
361
  const mixedPublicInstance =
356
- RendererProxy.getPublicInstanceFromInternalInstanceHandle(instanceHandle);
362
+ getRendererProxy().getPublicInstanceFromInternalInstanceHandle(
363
+ instanceHandle,
364
+ );
357
365
  // $FlowExpectedError[incompatible-return] React defines public instances as "mixed" because it can't access the definition from React Native.
358
366
  return mixedPublicInstance;
359
367
  }
@@ -33,10 +33,10 @@ type IntersectionObserverInit = {
33
33
  * If set, it will either be a singular ratio value between 0-1 (inclusive)
34
34
  * or an array of such ratios.
35
35
  *
36
- * Note: If `rn_rootThreshold` is set, and `threshold` is not set,
36
+ * Note: If `rnRootThreshold` is set, and `threshold` is not set,
37
37
  * `threshold` will not default to [0] (as per spec)
38
38
  */
39
- rn_rootThreshold?: number | $ReadOnlyArray<number>,
39
+ rnRootThreshold?: number | $ReadOnlyArray<number>,
40
40
  };
41
41
 
42
42
  /**
@@ -57,7 +57,7 @@ type IntersectionObserverInit = {
57
57
  *
58
58
  * This implementation only supports the `threshold` option at the moment
59
59
  * (`root` and `rootMargin` are not supported) and provides a React Native specific
60
- * option `rn_rootThreshold`.
60
+ * option `rnRootThreshold`.
61
61
  *
62
62
  */
63
63
  export default class IntersectionObserver {
@@ -99,7 +99,7 @@ export default class IntersectionObserver {
99
99
 
100
100
  this._callback = callback;
101
101
 
102
- this._rootThresholds = normalizeRootThreshold(options?.rn_rootThreshold);
102
+ this._rootThresholds = normalizeRootThreshold(options?.rnRootThreshold);
103
103
  this._thresholds = normalizeThreshold(
104
104
  options?.threshold,
105
105
  this._rootThresholds != null, // only provide default if no rootThreshold
@@ -136,9 +136,9 @@ export default class IntersectionObserver {
136
136
  * threshold is a ratio of intersection area to bounding box area of an
137
137
  * observed target.
138
138
  * Notifications for a target are generated when any of the thresholds specified
139
- * in `rn_rootThreshold` or `threshold` are crossed for that target.
139
+ * in `rnRootThreshold` or `threshold` are crossed for that target.
140
140
  *
141
- * If no value was passed to the constructor, and no `rn_rootThreshold`
141
+ * If no value was passed to the constructor, and no `rnRootThreshold`
142
142
  * is set, `0` is used.
143
143
  */
144
144
  get thresholds(): $ReadOnlyArray<number> {
@@ -150,9 +150,9 @@ export default class IntersectionObserver {
150
150
  * threshold is a ratio of intersection area to bounding box area of the specified
151
151
  * root view, which defaults to the viewport.
152
152
  * Notifications for a target are generated when any of the thresholds specified
153
- * in `rn_rootThreshold` or `threshold` are crossed for that target.
153
+ * in `rnRootThreshold` or `threshold` are crossed for that target.
154
154
  */
155
- get rootThresholds(): $ReadOnlyArray<number> | null {
155
+ get rnRootThresholds(): $ReadOnlyArray<number> | null {
156
156
  return this._rootThresholds;
157
157
  }
158
158
 
@@ -293,7 +293,7 @@ function normalizeThreshold(
293
293
  }
294
294
 
295
295
  /**
296
- * Converts the user defined `rn_rootThreshold` value into an array of sorted valid
296
+ * Converts the user defined `rnRootThreshold` value into an array of sorted valid
297
297
  * threshold options for `IntersectionObserver` (double ∈ [0, 1]).
298
298
  *
299
299
  * If invalid array or null, returns null.
@@ -310,13 +310,13 @@ function normalizeRootThreshold(
310
310
  ): null | $ReadOnlyArray<number> {
311
311
  if (Array.isArray(rootThreshold)) {
312
312
  const normalizedArr = rootThreshold
313
- .map(rt => normalizeThresholdValue(rt, 'rn_rootThreshold'))
313
+ .map(rt => normalizeThresholdValue(rt, 'rnRootThreshold'))
314
314
  .filter((rt): rt is number => rt != null)
315
315
  .sort();
316
316
  return normalizedArr.length === 0 ? null : normalizedArr;
317
317
  }
318
318
 
319
- const normalized = normalizeThresholdValue(rootThreshold, 'rn_rootThreshold');
319
+ const normalized = normalizeThresholdValue(rootThreshold, 'rnRootThreshold');
320
320
  return normalized == null ? null : [normalized];
321
321
  }
322
322
 
@@ -77,7 +77,7 @@ export default class IntersectionObserverEntry {
77
77
  /**
78
78
  * Returns the ratio of the `intersectionRect` to the `boundingRootRect`.
79
79
  */
80
- get rn_intersectionRootRatio(): number {
80
+ get rnRootIntersectionRatio(): number {
81
81
  const intersectionRect = this.intersectionRect;
82
82
 
83
83
  const rootRect = this._nativeEntry.rootRect;
@@ -162,7 +162,7 @@ export function observe({
162
162
  intersectionObserverId,
163
163
  targetShadowNode,
164
164
  thresholds: registeredObserver.observer.thresholds,
165
- rootThresholds: registeredObserver.observer.rootThresholds,
165
+ rootThresholds: registeredObserver.observer.rnRootThresholds,
166
166
  });
167
167
 
168
168
  return true;