react-native-windows 0.77.0-preview.4 → 0.78.0-preview.1
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.
- package/.flowconfig +1 -1
- package/Chakra/ChakraTracing.cpp +1 -1
- package/Libraries/Animated/animations/Animation.js +22 -1
- package/Libraries/Animated/animations/DecayAnimation.js +1 -0
- package/Libraries/Animated/animations/SpringAnimation.js +1 -0
- package/Libraries/Animated/animations/TimingAnimation.js +1 -0
- package/Libraries/Animated/nodes/AnimatedAddition.js +9 -2
- package/Libraries/Animated/nodes/AnimatedColor.js +4 -1
- package/Libraries/Animated/nodes/AnimatedDiffClamp.js +10 -2
- package/Libraries/Animated/nodes/AnimatedDivision.js +9 -2
- package/Libraries/Animated/nodes/AnimatedInterpolation.js +5 -1
- package/Libraries/Animated/nodes/AnimatedModulo.js +5 -2
- package/Libraries/Animated/nodes/AnimatedMultiplication.js +9 -2
- package/Libraries/Animated/nodes/AnimatedNode.js +25 -46
- package/Libraries/Animated/nodes/AnimatedObject.js +9 -2
- package/Libraries/Animated/nodes/AnimatedProps.js +5 -1
- package/Libraries/Animated/nodes/AnimatedStyle.js +5 -1
- package/Libraries/Animated/nodes/AnimatedSubtraction.js +9 -2
- package/Libraries/Animated/nodes/AnimatedTracking.js +5 -1
- package/Libraries/Animated/nodes/AnimatedTransform.js +5 -1
- package/Libraries/Animated/nodes/AnimatedValue.js +49 -4
- package/Libraries/Animated/nodes/AnimatedValueXY.js +3 -1
- package/Libraries/Animated/useAnimatedProps.js +0 -43
- package/Libraries/Components/Button.windows.js +3 -0
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.d.ts +1 -1
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js +3 -1
- package/Libraries/Components/LayoutConformance/LayoutConformance.d.ts +21 -0
- package/Libraries/Components/LayoutConformance/LayoutConformance.js +59 -0
- package/Libraries/Components/LayoutConformance/LayoutConformanceNativeComponent.js +29 -0
- package/Libraries/Components/Pressable/Pressable.windows.js +3 -0
- package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +1 -0
- package/Libraries/Components/TextInput/TextInput.d.ts +5 -0
- package/Libraries/Components/TextInput/TextInput.flow.js +6 -0
- package/Libraries/Components/TextInput/TextInput.js +6 -0
- package/Libraries/Components/TextInput/TextInput.windows.js +9 -0
- package/Libraries/Components/Touchable/TouchableBounce.windows.js +2 -0
- package/Libraries/Components/Touchable/TouchableNativeFeedback.windows.js +2 -0
- package/Libraries/Components/Touchable/TouchableOpacity.windows.js +2 -0
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.windows.js +2 -0
- package/Libraries/Components/View/View.windows.js +3 -0
- package/Libraries/Components/View/ViewAccessibility.d.ts +7 -2
- package/Libraries/Components/View/ViewAccessibility.windows.js +1 -0
- package/Libraries/Components/View/ViewPropTypes.d.ts +0 -7
- package/Libraries/Components/View/ViewPropTypes.js +0 -9
- package/Libraries/Components/View/ViewPropTypes.windows.js +1 -9
- package/Libraries/Core/ReactNativeVersion.js +2 -2
- package/Libraries/Core/setUpBatchedBridge.js +1 -16
- package/Libraries/EventEmitter/RCTEventEmitter.js +2 -6
- package/Libraries/Image/AssetSourceResolver.js +11 -0
- package/Libraries/Image/AssetSourceResolver.windows.js +11 -0
- package/Libraries/Image/Image.windows.js +2 -0
- package/Libraries/Inspector/BorderBox.js +26 -14
- package/Libraries/Inspector/BoxInspector.js +60 -42
- package/Libraries/Inspector/ElementBox.js +55 -48
- package/Libraries/Inspector/StyleInspector.js +36 -30
- package/Libraries/LayoutAnimation/LayoutAnimation.js +2 -2
- package/Libraries/Lists/FlatList.d.ts +1 -1
- package/Libraries/Modal/Modal.js +2 -0
- package/Libraries/Modal/Modal.windows.js +2 -0
- package/Libraries/NativeComponent/BaseViewConfig.android.js +0 -2
- package/Libraries/NativeComponent/BaseViewConfig.ios.js +0 -2
- package/Libraries/NativeComponent/BaseViewConfig.windows.js +0 -2
- package/Libraries/Network/RCTNetworking.android.js +24 -16
- package/Libraries/Network/RCTNetworking.ios.js +1 -46
- package/Libraries/Network/RCTNetworking.windows.js +1 -46
- package/Libraries/Network/RCTNetworkingEventDefinitions.flow.js +57 -0
- package/Libraries/ReactNative/UIManagerProperties.js +3 -1
- package/Libraries/Renderer/implementations/ReactFabric-dev.js +15828 -26461
- package/Libraries/Renderer/implementations/ReactFabric-prod.js +3907 -2560
- package/Libraries/Renderer/implementations/ReactFabric-profiling.js +4399 -2878
- package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +16102 -26908
- package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +4034 -2695
- package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +4535 -3045
- package/Libraries/Renderer/shims/ReactNativeTypes.js +5 -6
- package/Libraries/StyleSheet/processTransform.js +6 -0
- package/Libraries/Text/Text.d.ts +6 -1
- package/Libraries/Text/Text.windows.js +4 -0
- package/Libraries/Text/TextProps.js +2 -2
- package/Libraries/Text/TextProps.windows.js +3 -2
- package/Libraries/Utilities/BackHandler.android.js +5 -4
- package/Libraries/Utilities/BackHandler.ios.js +4 -5
- package/Libraries/Utilities/BackHandler.windows.js +5 -4
- package/Microsoft.ReactNative/CompositionComponentView.idl +13 -1
- package/Microsoft.ReactNative/Fabric/ComponentView.cpp +0 -1
- package/Microsoft.ReactNative/Fabric/Composition/ComponentViewRegistry.cpp +0 -5
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +92 -17
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.h +9 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +13 -33
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.h +1 -3
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.cpp +43 -5
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.h +2 -1
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +12 -10
- package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp +11 -9
- package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h +1 -1
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +191 -329
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.h +3 -61
- package/Microsoft.ReactNative/Fabric/Composition/PortalComponentView.cpp +66 -0
- package/Microsoft.ReactNative/Fabric/Composition/PortalComponentView.h +52 -0
- package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.cpp +21 -0
- package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.h +7 -4
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +79 -19
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +12 -6
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp +71 -17
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.h +16 -0
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentDescriptor.h +5 -10
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +4 -4
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.cpp +138 -110
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.h +27 -27
- package/Microsoft.ReactNative/Fabric/Composition/Theme.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp +38 -33
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.h +0 -2
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +5 -16
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.h +0 -3
- package/Microsoft.ReactNative/Fabric/ImageManager.cpp +9 -0
- package/Microsoft.ReactNative/Fabric/WindowsComponentDescriptorRegistry.cpp +0 -2
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/PlatformColorUtils.cpp +1 -1
- package/Microsoft.ReactNative/IReactCompositionViewComponentBuilder.idl +5 -0
- package/Microsoft.ReactNative/IReactContext.cpp +2 -2
- package/Microsoft.ReactNative/IReactContext.h +1 -1
- package/Microsoft.ReactNative/IReactContext.idl +2 -2
- package/Microsoft.ReactNative/IReactPackageBuilder.idl +3 -3
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +97 -87
- package/Microsoft.ReactNative/Modules/AccessibilityInfoModule.cpp +4 -0
- package/Microsoft.ReactNative/Modules/AlertModule.cpp +9 -4
- package/Microsoft.ReactNative/Modules/Animated/NativeAnimatedNodeManager.cpp +1 -1
- package/Microsoft.ReactNative/Modules/Animated/PropsAnimatedNode.cpp +32 -35
- package/Microsoft.ReactNative/Modules/Animated/PropsAnimatedNode.h +7 -4
- package/Microsoft.ReactNative/Modules/AppStateModule.cpp +1 -1
- package/Microsoft.ReactNative/Modules/AppThemeModuleUwp.cpp +2 -2
- package/Microsoft.ReactNative/Modules/AppearanceModule.cpp +2 -2
- package/Microsoft.ReactNative/Modules/DeviceInfoModule.cpp +3 -3
- package/Microsoft.ReactNative/Modules/I18nManagerModule.cpp +1 -1
- package/Microsoft.ReactNative/Modules/LogBoxModule.cpp +7 -5
- package/Microsoft.ReactNative/Modules/LogBoxModule.h +2 -1
- package/Microsoft.ReactNative/Modules/NativeUIManager.cpp +10 -10
- package/Microsoft.ReactNative/Modules/PaperUIManagerModule.cpp +24 -24
- package/Microsoft.ReactNative/Modules/Timing.cpp +2 -2
- package/Microsoft.ReactNative/ReactHost/IReactInstance.h +5 -0
- package/Microsoft.ReactNative/ReactHost/React.h +0 -3
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +39 -16
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.h +4 -2
- package/Microsoft.ReactNative/ReactNativeHost.cpp +9 -4
- package/Microsoft.ReactNative/ReactNativeIsland.idl +5 -1
- package/Microsoft.ReactNative/ReactPackageBuilder.cpp +3 -3
- package/Microsoft.ReactNative/ReactPackageBuilder.h +4 -4
- package/Microsoft.ReactNative/Utils/Helpers.cpp +0 -2
- package/Microsoft.ReactNative/Views/DevMenu.cpp +6 -6
- package/Microsoft.ReactNative/Views/DevMenu.h +1 -1
- package/Microsoft.ReactNative/Views/ViewManagerBase.cpp +2 -2
- package/Microsoft.ReactNative/Views/ViewPanel.cpp +1 -1
- package/Microsoft.ReactNative/Views/ViewViewManager.cpp +2 -2
- package/Microsoft.ReactNative/XamlUIService.cpp +13 -7
- package/Microsoft.ReactNative/XamlUIService.h +4 -1
- package/Microsoft.ReactNative/XamlUIService.idl +2 -0
- package/Microsoft.ReactNative.Cxx/JSI/JsiAbiApi.h +6 -2
- package/Microsoft.ReactNative.Cxx/ReactContext.h +1 -1
- package/Microsoft.ReactNative.Cxx/XamlUtils.h +12 -0
- package/PropertySheets/Generated/PackageVersion.g.props +3 -3
- package/PropertySheets/React.Cpp.props +3 -0
- package/PropertySheets/WebView2.props +1 -1
- package/PropertySheets/WinUI.props +5 -4
- package/ReactCommon/ReactCommon.vcxproj +5 -1
- package/ReactCommon/ReactCommon.vcxproj.filters +1 -1
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/JSExecutor.cpp +3 -3
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/NativeToJsBridge.cpp +3 -3
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsi/jsi/test/testlib.cpp +91 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/componentregistry/ComponentDescriptorRegistry.cpp +1 -12
- package/{Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputState.h → ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/textinput/TextInputState.h} +37 -35
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/AccessibilityPrimitives.h +1 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/accessibilityPropsConversions.h +4 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/imagemanager/ImageRequestParams.h +30 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/runtimescheduler/SchedulerPriorityUtils.h +4 -3
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/uimanager/primitives.h +179 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/runtime/ReactInstance.cpp +43 -57
- package/Shared/HermesRuntimeHolder.cpp +2 -2
- package/Shared/Shared.vcxitems +8 -14
- package/Shared/Shared.vcxitems.filters +4 -16
- package/Shared/Threading/BatchingQueueThread.cpp +3 -3
- package/codegen/NativeCPUTimeSpec.g.h +41 -0
- package/codegen/NativeFantomSpec.g.h +78 -0
- package/codegen/NativePerformanceSpec.g.h +31 -43
- package/codegen/NativeReactNativeFeatureFlagsSpec.g.h +84 -84
- package/codegen/react/components/rnwcore/ActivityIndicatorView.g.h +212 -0
- package/codegen/react/components/rnwcore/AndroidDrawerLayout.g.h +295 -0
- package/codegen/react/components/rnwcore/AndroidHorizontalScrollContentView.g.h +200 -0
- package/codegen/react/components/rnwcore/AndroidProgressBar.g.h +224 -0
- package/codegen/react/components/rnwcore/AndroidSwipeRefreshLayout.g.h +250 -0
- package/codegen/react/components/rnwcore/AndroidSwitch.g.h +267 -0
- package/codegen/react/components/rnwcore/DebuggingOverlay.g.h +234 -0
- package/codegen/react/components/rnwcore/InputAccessory.g.h +200 -0
- package/codegen/react/components/rnwcore/ModalHostView.g.h +283 -0
- package/codegen/react/components/rnwcore/PullToRefreshView.g.h +246 -0
- package/codegen/react/components/rnwcore/SafeAreaView.g.h +197 -0
- package/codegen/react/components/rnwcore/Switch.g.h +263 -0
- package/codegen/react/components/rnwcore/UnimplementedNativeView.g.h +200 -0
- package/codegen/rnwcoreJSI-generated.cpp +90 -57
- package/codegen/rnwcoreJSI.h +241 -104
- package/index.js +5 -0
- package/index.windows.js +5 -0
- package/just-task.js +1 -1
- package/package.json +23 -24
- package/src/private/animated/NativeAnimatedValidation.js +1 -1
- package/src/private/featureflags/ReactNativeFeatureFlags.js +32 -26
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +5 -5
- package/src/private/renderer/errorhandling/ErrorHandlers.js +12 -55
- package/src/private/specs/modules/{NativeJSCSamplingProfiler.js → NativeCPUTime.js} +7 -2
- package/src/private/specs/modules/NativeFantom.js +37 -0
- package/src/private/utilities/ensureInstance.js +21 -0
- package/src/private/webapis/dom/nodes/ReactNativeElement.js +49 -6
- package/src/private/webapis/dom/nodes/ReadOnlyNode.js +17 -9
- package/src/private/webapis/intersectionobserver/IntersectionObserver.js +11 -11
- package/src/private/webapis/intersectionobserver/IntersectionObserverEntry.js +1 -1
- package/src/private/webapis/intersectionobserver/IntersectionObserverManager.js +1 -1
- package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +1 -0
- package/src/private/webapis/performance/Performance.js +0 -12
- package/src/private/webapis/performance/specs/NativePerformance.js +0 -11
- package/types/index.d.ts +1 -0
- package/Libraries/HeapCapture/HeapCapture.js +0 -29
- package/Libraries/HeapCapture/NativeJSCHeapCapture.js +0 -13
- package/Libraries/Performance/NativeJSCSamplingProfiler.js +0 -13
- package/Libraries/Performance/SamplingProfiler.js +0 -39
- package/Libraries/ReactNative/__mocks__/FabricUIManager.js +0 -334
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentDescriptor.h +0 -39
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewShadowNode.cpp +0 -18
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewShadowNode.h +0 -39
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputState.cpp +0 -34
- package/Microsoft.ReactNative/Fabric/ReactNativeConfigProperties.cpp +0 -53
- package/Microsoft.ReactNative/Fabric/ReactNativeConfigProperties.h +0 -26
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/LayoutableShadowNode.cpp +0 -363
- package/codegen/NativeJSCSamplingProfilerSpec.g.h +0 -35
- package/src/private/webapis/dom/nodes/specs/__mocks__/NativeDOMMock.js +0 -413
- package/src/private/webapis/intersectionobserver/specs/__mocks__/NativeIntersectionObserver.js +0 -181
- 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<<
|
|
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
|
-
|
|
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',
|
|
159
|
+
export const shouldSkipStateUpdatesForLoopingAnimations: Getter<boolean> = createJavaScriptFlagGetter('shouldSkipStateUpdatesForLoopingAnimations', true);
|
|
154
160
|
|
|
155
161
|
/**
|
|
156
162
|
* Enables use of AnimatedObject for animating transform values.
|
|
@@ -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
|
-
*
|
|
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
|
|
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',
|
|
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',
|
|
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<<
|
|
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
|
-
+
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
+
|
|
20
|
+
+getCPUTimeNanos: () => number;
|
|
21
|
+
+hasAccurateCPUTimeNanosForBenchmarks: () => boolean;
|
|
17
22
|
}
|
|
18
23
|
|
|
19
|
-
export default (TurboModuleRegistry.
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
195
|
+
warnForStyleProps(nativeProps, this.__viewConfig.validAttributes);
|
|
175
196
|
}
|
|
176
197
|
|
|
177
198
|
const updatePayload = createAttributePayload(
|
|
178
199
|
nativeProps,
|
|
179
|
-
this
|
|
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
|
-
|
|
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
|
-
|
|
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 `
|
|
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
|
-
|
|
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 `
|
|
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?.
|
|
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 `
|
|
139
|
+
* in `rnRootThreshold` or `threshold` are crossed for that target.
|
|
140
140
|
*
|
|
141
|
-
* If no value was passed to the constructor, and no `
|
|
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 `
|
|
153
|
+
* in `rnRootThreshold` or `threshold` are crossed for that target.
|
|
154
154
|
*/
|
|
155
|
-
get
|
|
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 `
|
|
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, '
|
|
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, '
|
|
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
|
|
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.
|
|
165
|
+
rootThresholds: registeredObserver.observer.rnRootThresholds,
|
|
166
166
|
});
|
|
167
167
|
|
|
168
168
|
return true;
|
|
@@ -17,6 +17,7 @@ export type NativeIntersectionObserverEntry = {
|
|
|
17
17
|
targetInstanceHandle: mixed,
|
|
18
18
|
targetRect: $ReadOnlyArray<number>, // It's actually a tuple with x, y, width and height
|
|
19
19
|
rootRect: $ReadOnlyArray<number>, // It's actually a tuple with x, y, width and height
|
|
20
|
+
// TODO(T209328432) - Remove optionality of intersectionRect when native changes are released
|
|
20
21
|
intersectionRect: ?$ReadOnlyArray<number>, // It's actually a tuple with x, y, width and height
|
|
21
22
|
isIntersectingAboveThresholds: boolean,
|
|
22
23
|
time: number,
|