@office-iss/react-native-win32 0.0.0-canary.258 → 0.0.0-canary.260
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 +2 -4
- package/CHANGELOG.json +31 -1
- package/CHANGELOG.md +24 -8
- package/Libraries/Alert/Alert.js +3 -0
- package/Libraries/Animated/AnimatedImplementation.js +7 -7
- package/Libraries/Animated/animations/Animation.js +10 -0
- package/Libraries/Animated/animations/TimingAnimation.js +1 -0
- package/Libraries/Animated/components/AnimatedScrollView.js +2 -2
- package/Libraries/Animated/createAnimatedComponent.js +1 -1
- package/Libraries/Animated/nodes/AnimatedValue.js +1 -0
- package/Libraries/Animated/useAnimatedProps.js +138 -6
- package/Libraries/BatchedBridge/NativeModules.js +2 -0
- package/Libraries/Blob/FileReader.js +1 -1
- package/Libraries/Blob/URL.js +2 -62
- package/Libraries/Blob/URLSearchParams.js +71 -0
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +1 -1
- package/Libraries/Components/RefreshControl/__mocks__/RefreshControlMock.js +1 -1
- package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +3 -0
- package/Libraries/Components/ScrollView/ScrollView.js +5 -5
- package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +3 -0
- package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +1 -1
- package/Libraries/Components/StatusBar/StatusBar.js +3 -1
- package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +3 -0
- package/Libraries/Components/TextInput/TextInput.d.ts +32 -2
- package/Libraries/Components/TextInput/TextInput.js +220 -80
- package/Libraries/Components/TextInput/TextInput.win32.js +220 -86
- package/Libraries/Components/View/ReactNativeStyleAttributes.js +22 -0
- package/Libraries/Components/View/ReactNativeViewAttributes.js +2 -0
- package/Libraries/Components/View/ReactNativeViewAttributes.win32.js +2 -0
- package/Libraries/Components/View/ViewAccessibility.d.ts +15 -0
- package/Libraries/Components/View/ViewNativeComponent.js +6 -0
- package/Libraries/Components/View/ViewPropTypes.js +14 -0
- package/Libraries/Components/View/ViewPropTypes.win32.js +14 -0
- package/Libraries/Core/ExceptionsManager.js +2 -0
- package/Libraries/Core/InitializeCore.js +1 -1
- package/Libraries/Core/ReactFiberErrorDialog.js +3 -0
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Core/setUpErrorHandling.js +7 -1
- package/Libraries/Core/setUpReactRefresh.js +0 -4
- package/Libraries/Image/AssetSourceResolver.js +28 -1
- package/Libraries/Image/Image.android.js +9 -14
- package/Libraries/Image/Image.ios.js +11 -22
- package/Libraries/Image/Image.win32.js +10 -21
- package/Libraries/Image/ImageBackground.js +1 -8
- package/Libraries/Image/ImageUtils.js +9 -9
- package/Libraries/Image/ImageViewNativeComponent.js +4 -0
- package/Libraries/Inspector/NetworkOverlay.js +1 -1
- package/Libraries/Interaction/TaskQueue.js +1 -0
- package/Libraries/Lists/FlatList.js +1 -1
- package/Libraries/Lists/SectionList.js +2 -2
- package/Libraries/Lists/SectionListModern.js +1 -1
- package/Libraries/LogBox/Data/LogBoxData.js +31 -4
- package/Libraries/NativeComponent/BaseViewConfig.android.js +2 -0
- package/Libraries/NativeComponent/BaseViewConfig.ios.js +7 -0
- package/Libraries/NativeComponent/BaseViewConfig.win32.js +7 -0
- package/Libraries/NativeComponent/NativeComponentRegistry.js +9 -2
- package/Libraries/Network/XMLHttpRequest.js +4 -2
- package/Libraries/ReactNative/BridgelessUIManager.js +1 -0
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +1 -1
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +5 -5
- package/Libraries/ReactNative/RendererImplementation.js +24 -2
- package/Libraries/ReactNative/getNativeComponentAttributes.js +8 -0
- package/Libraries/Renderer/shims/ReactNativeTypes.js +3 -1
- package/Libraries/StyleSheet/StyleSheet.js +1 -1
- package/Libraries/StyleSheet/StyleSheet.win32.js +1 -1
- package/Libraries/StyleSheet/StyleSheetTypes.d.ts +57 -19
- package/Libraries/StyleSheet/StyleSheetTypes.js +60 -23
- package/Libraries/StyleSheet/processBackgroundImage.js +286 -0
- package/Libraries/StyleSheet/processBoxShadow.js +211 -0
- package/Libraries/StyleSheet/processFilter.js +24 -14
- package/Libraries/Text/Text.js +395 -212
- package/Libraries/Text/Text.win32.js +443 -245
- package/Libraries/Text/TextNativeComponent.js +7 -0
- package/Libraries/Text/TextNativeComponent.win32.js +7 -0
- package/Libraries/TurboModule/TurboModuleRegistry.js +13 -50
- package/Libraries/Types/CodegenTypes.js +3 -1
- package/Libraries/Utilities/HMRClient.js +1 -0
- package/Libraries/Utilities/Platform.android.js +1 -1
- package/Libraries/Utilities/Platform.d.ts +1 -1
- package/Libraries/Utilities/Platform.flow.js +2 -2
- package/Libraries/Utilities/Platform.flow.win32.js +3 -3
- package/Libraries/Utilities/Platform.ios.js +1 -1
- package/Libraries/Utilities/Platform.win32.js +1 -1
- package/Libraries/Utilities/ReactNativeTestTools.js +1 -1
- package/Libraries/WebSocket/WebSocket.js +1 -1
- package/Libraries/vendor/emitter/EventEmitter.js +1 -0
- package/flow/jest.js +2 -2
- package/index.js +1 -0
- package/index.win32.js +1 -0
- package/jest/mockModal.js +1 -3
- package/jest/mockScrollView.js +1 -1
- package/jest/renderer.js +2 -2
- package/jest/setup.js +16 -9
- package/overrides.json +16 -16
- package/package.json +15 -15
- package/src/private/{core/components → components}/HScrollViewNativeComponents.js +8 -8
- package/src/private/{core/components → components}/VScrollViewNativeComponents.js +7 -7
- package/src/private/{core/components → components}/useSyncOnScroll.js +2 -2
- package/src/private/featureflags/ReactNativeFeatureFlags.js +143 -19
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +25 -5
- package/src/private/hooks/DebouncedEffectImplementation.js +148 -0
- package/src/private/hooks/useDebouncedEffect.js +23 -0
- package/{Libraries/Core → src/private/renderer/errorhandling}/ErrorHandlers.js +14 -4
- package/src/private/setup/setUpDOM.js +28 -0
- package/src/private/setup/setUpIntersectionObserver.js +27 -0
- package/src/private/setup/setUpMutationObserver.js +26 -0
- package/src/private/setup/setUpPerformanceObserver.js +64 -0
- package/src/private/specs/modules/NativeDebuggerSessionObserver.js +23 -0
- package/src/private/specs/modules/NativeLinkingManager.js +1 -1
- package/src/private/specs/modules/NativePlatformConstantsAndroid.js +1 -1
- package/src/private/specs/modules/NativePlatformConstantsIOS.js +1 -1
- package/src/private/specs/modules/NativePlatformConstantsWin.js +8 -1
- package/src/private/webapis/dom/nodes/ReadOnlyNode.js +6 -4
- package/{Libraries/IntersectionObserver → src/private/webapis/intersectionobserver}/IntersectionObserver.js +1 -1
- package/{Libraries/IntersectionObserver → src/private/webapis/intersectionobserver}/IntersectionObserverEntry.js +3 -3
- package/{Libraries/IntersectionObserver → src/private/webapis/intersectionobserver}/IntersectionObserverManager.js +5 -8
- package/src/private/{specs/modules → webapis/intersectionobserver/specs}/NativeIntersectionObserver.js +2 -2
- package/{Libraries/IntersectionObserver → src/private/webapis/intersectionobserver/specs}/__mocks__/NativeIntersectionObserver.js +4 -4
- package/{Libraries/MutationObserver → src/private/webapis/mutationobserver}/MutationObserver.js +1 -1
- package/{Libraries/MutationObserver → src/private/webapis/mutationobserver}/MutationObserverManager.js +5 -5
- package/{Libraries/MutationObserver → src/private/webapis/mutationobserver}/MutationRecord.js +4 -6
- package/src/private/{specs/modules → webapis/mutationobserver/specs}/NativeMutationObserver.js +2 -2
- package/{Libraries/MutationObserver → src/private/webapis/mutationobserver/specs}/__mocks__/NativeMutationObserver.js +5 -5
- package/src/private/webapis/performance/{EventCounts.js → EventTiming.js} +65 -3
- package/src/private/webapis/performance/LongTasks.js +39 -0
- package/src/private/webapis/performance/Performance.js +22 -9
- package/src/private/webapis/performance/PerformanceEntry.js +36 -18
- package/src/private/webapis/performance/PerformanceObserver.js +29 -43
- package/src/private/webapis/performance/RawPerformanceEntry.js +24 -1
- package/src/private/webapis/performance/UserTiming.js +17 -12
- package/src/private/webapis/performance/specs/NativePerformanceObserver.js +1 -1
- package/src-win/Libraries/Components/View/ViewAccessibility.d.ts +15 -0
- package/types/experimental.d.ts +20 -1
- package/Libraries/Core/setUpIntersectionObserver.js +0 -16
- package/Libraries/Core/setUpMutationObserver.js +0 -16
- package/Libraries/Core/setUpPerformanceObserver.js +0 -18
- package/Libraries/IntersectionObserver/NativeIntersectionObserver.js +0 -13
- package/Libraries/MutationObserver/NativeMutationObserver.js +0 -13
- package/Libraries/Text/TextOptimized.js +0 -538
- package/src/private/core/setUpDOM.js +0 -18
- package/src/private/webapis/performance/PerformanceEventTiming.js +0 -55
- /package/src/private/{core → styles}/composeStyles.js +0 -0
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
* @oncall react_native
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import type {ScrollViewNativeProps} from '
|
|
13
|
-
import type {HostComponent} from '
|
|
12
|
+
import type {ScrollViewNativeProps} from '../../../Libraries/Components/ScrollView/ScrollViewNativeComponentType';
|
|
13
|
+
import type {HostComponent} from '../../../Libraries/Renderer/shims/ReactNativeTypes';
|
|
14
14
|
|
|
15
15
|
import * as React from 'react';
|
|
16
16
|
import {useImperativeHandle, useRef, useState} from 'react';
|
|
@@ -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<<fb7a3dcf7b3e5001e45f808fb4410376>>
|
|
8
8
|
* @flow strict-local
|
|
9
9
|
*/
|
|
10
10
|
|
|
@@ -31,10 +31,14 @@ export type ReactNativeFeatureFlagsJsOnly = {
|
|
|
31
31
|
animatedShouldUseSingleOp: Getter<boolean>,
|
|
32
32
|
enableAccessToHostTreeInFabric: Getter<boolean>,
|
|
33
33
|
isLayoutAnimationEnabled: Getter<boolean>,
|
|
34
|
+
shouldSkipStateUpdatesForLoopingAnimations: Getter<boolean>,
|
|
34
35
|
shouldUseAnimatedObjectForTransform: Getter<boolean>,
|
|
35
|
-
|
|
36
|
+
shouldUseDebouncedEffectsForAnimated: Getter<boolean>,
|
|
36
37
|
shouldUseRemoveClippedSubviewsAsDefaultOnIOS: Getter<boolean>,
|
|
37
38
|
shouldUseSetNativePropsInFabric: Getter<boolean>,
|
|
39
|
+
shouldUseSetNativePropsInNativeAnimationsInFabric: Getter<boolean>,
|
|
40
|
+
usePassiveEffectsForAnimations: Getter<boolean>,
|
|
41
|
+
useRefsForTextInputState: Getter<boolean>,
|
|
38
42
|
};
|
|
39
43
|
|
|
40
44
|
export type ReactNativeFeatureFlagsJsOnlyOverrides = Partial<ReactNativeFeatureFlagsJsOnly>;
|
|
@@ -42,30 +46,50 @@ export type ReactNativeFeatureFlagsJsOnlyOverrides = Partial<ReactNativeFeatureF
|
|
|
42
46
|
export type ReactNativeFeatureFlags = {
|
|
43
47
|
...ReactNativeFeatureFlagsJsOnly,
|
|
44
48
|
commonTestFlag: Getter<boolean>,
|
|
45
|
-
allowCollapsableChildren: Getter<boolean>,
|
|
46
49
|
allowRecursiveCommitsWithSynchronousMountOnAndroid: Getter<boolean>,
|
|
47
50
|
batchRenderingUpdatesInEventLoop: Getter<boolean>,
|
|
51
|
+
changeOrderOfMountingInstructionsOnAndroid: Getter<boolean>,
|
|
52
|
+
completeReactInstanceCreationOnBgThreadOnAndroid: Getter<boolean>,
|
|
48
53
|
destroyFabricSurfacesInReactInstanceManager: Getter<boolean>,
|
|
49
|
-
|
|
54
|
+
enableAlignItemsBaselineOnFabricIOS: Getter<boolean>,
|
|
55
|
+
enableAndroidMixBlendModeProp: Getter<boolean>,
|
|
56
|
+
enableBackgroundStyleApplicator: Getter<boolean>,
|
|
50
57
|
enableCleanTextInputYogaNode: Getter<boolean>,
|
|
58
|
+
enableEagerRootViewAttachment: Getter<boolean>,
|
|
59
|
+
enableEventEmitterRetentionDuringGesturesOnAndroid: Getter<boolean>,
|
|
60
|
+
enableFabricLogs: Getter<boolean>,
|
|
61
|
+
enableFabricRendererExclusively: Getter<boolean>,
|
|
51
62
|
enableGranularShadowTreeStateReconciliation: Getter<boolean>,
|
|
63
|
+
enableLongTaskAPI: Getter<boolean>,
|
|
52
64
|
enableMicrotasks: Getter<boolean>,
|
|
65
|
+
enablePropsUpdateReconciliationAndroid: Getter<boolean>,
|
|
66
|
+
enableReportEventPaintTime: Getter<boolean>,
|
|
53
67
|
enableSynchronousStateUpdates: Getter<boolean>,
|
|
54
68
|
enableUIConsistency: Getter<boolean>,
|
|
69
|
+
enableViewRecycling: Getter<boolean>,
|
|
70
|
+
excludeYogaFromRawProps: Getter<boolean>,
|
|
71
|
+
fetchImagesInViewPreallocation: Getter<boolean>,
|
|
72
|
+
fixIncorrectScrollViewStateUpdateOnAndroid: Getter<boolean>,
|
|
55
73
|
fixMappingOfEventPrioritiesBetweenFabricAndReact: Getter<boolean>,
|
|
56
|
-
|
|
74
|
+
fixMissedFabricStateUpdatesOnAndroid: Getter<boolean>,
|
|
57
75
|
forceBatchingMountItemsOnAndroid: Getter<boolean>,
|
|
58
76
|
fuseboxEnabledDebug: Getter<boolean>,
|
|
59
77
|
fuseboxEnabledRelease: Getter<boolean>,
|
|
78
|
+
initEagerTurboModulesOnNativeModulesQueueAndroid: Getter<boolean>,
|
|
60
79
|
lazyAnimationCallbacks: Getter<boolean>,
|
|
61
|
-
|
|
80
|
+
loadVectorDrawablesOnImages: Getter<boolean>,
|
|
62
81
|
setAndroidLayoutDirection: Getter<boolean>,
|
|
82
|
+
traceTurboModulePromiseRejectionsOnAndroid: Getter<boolean>,
|
|
83
|
+
useFabricInterop: Getter<boolean>,
|
|
63
84
|
useImmediateExecutorInAndroidBridgeless: Getter<boolean>,
|
|
64
85
|
useModernRuntimeScheduler: Getter<boolean>,
|
|
65
86
|
useNativeViewConfigsInBridgelessMode: Getter<boolean>,
|
|
87
|
+
useNewReactImageViewBackgroundDrawing: Getter<boolean>,
|
|
88
|
+
useOptimisedViewPreallocationOnAndroid: Getter<boolean>,
|
|
66
89
|
useRuntimeShadowNodeReferenceUpdate: Getter<boolean>,
|
|
67
90
|
useRuntimeShadowNodeReferenceUpdateOnLayout: Getter<boolean>,
|
|
68
91
|
useStateAlignmentMechanism: Getter<boolean>,
|
|
92
|
+
useTurboModuleInterop: Getter<boolean>,
|
|
69
93
|
}
|
|
70
94
|
|
|
71
95
|
/**
|
|
@@ -93,15 +117,20 @@ export const enableAccessToHostTreeInFabric: Getter<boolean> = createJavaScriptF
|
|
|
93
117
|
*/
|
|
94
118
|
export const isLayoutAnimationEnabled: Getter<boolean> = createJavaScriptFlagGetter('isLayoutAnimationEnabled', true);
|
|
95
119
|
|
|
120
|
+
/**
|
|
121
|
+
* If the animation is within Animated.loop, we do not send state updates to React.
|
|
122
|
+
*/
|
|
123
|
+
export const shouldSkipStateUpdatesForLoopingAnimations: Getter<boolean> = createJavaScriptFlagGetter('shouldSkipStateUpdatesForLoopingAnimations', false);
|
|
124
|
+
|
|
96
125
|
/**
|
|
97
126
|
* Enables use of AnimatedObject for animating transform values.
|
|
98
127
|
*/
|
|
99
128
|
export const shouldUseAnimatedObjectForTransform: Getter<boolean> = createJavaScriptFlagGetter('shouldUseAnimatedObjectForTransform', false);
|
|
100
129
|
|
|
101
130
|
/**
|
|
102
|
-
* Use
|
|
131
|
+
* Use new `useDebouncedEffects` hook for manging animated props lifecycle.
|
|
103
132
|
*/
|
|
104
|
-
export const
|
|
133
|
+
export const shouldUseDebouncedEffectsForAnimated: Getter<boolean> = createJavaScriptFlagGetter('shouldUseDebouncedEffectsForAnimated', false);
|
|
105
134
|
|
|
106
135
|
/**
|
|
107
136
|
* removeClippedSubviews prop will be used as the default in FlatList on iOS to match Android
|
|
@@ -114,13 +143,24 @@ export const shouldUseRemoveClippedSubviewsAsDefaultOnIOS: Getter<boolean> = cre
|
|
|
114
143
|
export const shouldUseSetNativePropsInFabric: Getter<boolean> = createJavaScriptFlagGetter('shouldUseSetNativePropsInFabric', true);
|
|
115
144
|
|
|
116
145
|
/**
|
|
117
|
-
*
|
|
146
|
+
* Enables use of setNativeProps in Native driven animations in Fabric.
|
|
118
147
|
*/
|
|
119
|
-
export const
|
|
148
|
+
export const shouldUseSetNativePropsInNativeAnimationsInFabric: Getter<boolean> = createJavaScriptFlagGetter('shouldUseSetNativePropsInNativeAnimationsInFabric', false);
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Enable a variant of useAnimatedPropsLifecycle hook that constructs the animation graph in passive effect instead of layout effect
|
|
152
|
+
*/
|
|
153
|
+
export const usePassiveEffectsForAnimations: Getter<boolean> = createJavaScriptFlagGetter('usePassiveEffectsForAnimations', false);
|
|
154
|
+
|
|
120
155
|
/**
|
|
121
|
-
*
|
|
156
|
+
* Enable a variant of TextInput that moves some state to refs to avoid unnecessary re-renders
|
|
122
157
|
*/
|
|
123
|
-
export const
|
|
158
|
+
export const useRefsForTextInputState: Getter<boolean> = createJavaScriptFlagGetter('useRefsForTextInputState', false);
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Common flag for testing. Do NOT modify.
|
|
162
|
+
*/
|
|
163
|
+
export const commonTestFlag: Getter<boolean> = createNativeFlagGetter('commonTestFlag', false);
|
|
124
164
|
/**
|
|
125
165
|
* Adds support for recursively processing commits that mount synchronously (Android only).
|
|
126
166
|
*/
|
|
@@ -129,26 +169,70 @@ export const allowRecursiveCommitsWithSynchronousMountOnAndroid: Getter<boolean>
|
|
|
129
169
|
* When enabled, the RuntimeScheduler processing the event loop will batch all rendering updates and dispatch them together at the end of each iteration of the loop.
|
|
130
170
|
*/
|
|
131
171
|
export const batchRenderingUpdatesInEventLoop: Getter<boolean> = createNativeFlagGetter('batchRenderingUpdatesInEventLoop', false);
|
|
172
|
+
/**
|
|
173
|
+
* When enabled, insert of views on Android will be moved from the beginning of the IntBufferBatchMountItem to be after layout updates.
|
|
174
|
+
*/
|
|
175
|
+
export const changeOrderOfMountingInstructionsOnAndroid: Getter<boolean> = createNativeFlagGetter('changeOrderOfMountingInstructionsOnAndroid', false);
|
|
176
|
+
/**
|
|
177
|
+
* Do not wait for a main-thread dispatch to complete init to start executing work on the JS thread on Android
|
|
178
|
+
*/
|
|
179
|
+
export const completeReactInstanceCreationOnBgThreadOnAndroid: Getter<boolean> = createNativeFlagGetter('completeReactInstanceCreationOnBgThreadOnAndroid', false);
|
|
132
180
|
/**
|
|
133
181
|
* When enabled, ReactInstanceManager will clean up Fabric surfaces on destroy().
|
|
134
182
|
*/
|
|
135
183
|
export const destroyFabricSurfacesInReactInstanceManager: Getter<boolean> = createNativeFlagGetter('destroyFabricSurfacesInReactInstanceManager', false);
|
|
136
184
|
/**
|
|
137
|
-
*
|
|
185
|
+
* Kill-switch to turn off support for aling-items:baseline on Fabric iOS.
|
|
186
|
+
*/
|
|
187
|
+
export const enableAlignItemsBaselineOnFabricIOS: Getter<boolean> = createNativeFlagGetter('enableAlignItemsBaselineOnFabricIOS', true);
|
|
188
|
+
/**
|
|
189
|
+
* Enables mix-blend-mode prop on Android.
|
|
190
|
+
*/
|
|
191
|
+
export const enableAndroidMixBlendModeProp: Getter<boolean> = createNativeFlagGetter('enableAndroidMixBlendModeProp', false);
|
|
192
|
+
/**
|
|
193
|
+
* Use BackgroundStyleApplicator in place of other background/border drawing code
|
|
138
194
|
*/
|
|
139
|
-
export const
|
|
195
|
+
export const enableBackgroundStyleApplicator: Getter<boolean> = createNativeFlagGetter('enableBackgroundStyleApplicator', true);
|
|
140
196
|
/**
|
|
141
197
|
* Clean yoga node when <TextInput /> does not change.
|
|
142
198
|
*/
|
|
143
199
|
export const enableCleanTextInputYogaNode: Getter<boolean> = createNativeFlagGetter('enableCleanTextInputYogaNode', false);
|
|
200
|
+
/**
|
|
201
|
+
* Feature flag to configure eager attachment of the root view/initialisation of the JS code.
|
|
202
|
+
*/
|
|
203
|
+
export const enableEagerRootViewAttachment: Getter<boolean> = createNativeFlagGetter('enableEagerRootViewAttachment', false);
|
|
204
|
+
/**
|
|
205
|
+
* Enables the retention of EventEmitterWrapper on Android till the touch gesture is over to fix a bug on pressable (#44610)
|
|
206
|
+
*/
|
|
207
|
+
export const enableEventEmitterRetentionDuringGesturesOnAndroid: Getter<boolean> = createNativeFlagGetter('enableEventEmitterRetentionDuringGesturesOnAndroid', false);
|
|
208
|
+
/**
|
|
209
|
+
* This feature flag enables logs for Fabric.
|
|
210
|
+
*/
|
|
211
|
+
export const enableFabricLogs: Getter<boolean> = createNativeFlagGetter('enableFabricLogs', false);
|
|
212
|
+
/**
|
|
213
|
+
* 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.
|
|
214
|
+
*/
|
|
215
|
+
export const enableFabricRendererExclusively: Getter<boolean> = createNativeFlagGetter('enableFabricRendererExclusively', false);
|
|
144
216
|
/**
|
|
145
217
|
* When enabled, the renderer would only fail commits when they propagate state and the last commit that updated state changed before committing.
|
|
146
218
|
*/
|
|
147
219
|
export const enableGranularShadowTreeStateReconciliation: Getter<boolean> = createNativeFlagGetter('enableGranularShadowTreeStateReconciliation', false);
|
|
220
|
+
/**
|
|
221
|
+
* Enables the reporting of long tasks through `PerformanceObserver`. Only works if the event loop is enabled.
|
|
222
|
+
*/
|
|
223
|
+
export const enableLongTaskAPI: Getter<boolean> = createNativeFlagGetter('enableLongTaskAPI', false);
|
|
148
224
|
/**
|
|
149
225
|
* Enables the use of microtasks in Hermes (scheduling) and RuntimeScheduler (execution).
|
|
150
226
|
*/
|
|
151
227
|
export const enableMicrotasks: Getter<boolean> = createNativeFlagGetter('enableMicrotasks', false);
|
|
228
|
+
/**
|
|
229
|
+
* When enabled, Android will receive prop updates based on the differences between the last rendered shadow node and the last committed shadow node.
|
|
230
|
+
*/
|
|
231
|
+
export const enablePropsUpdateReconciliationAndroid: Getter<boolean> = createNativeFlagGetter('enablePropsUpdateReconciliationAndroid', false);
|
|
232
|
+
/**
|
|
233
|
+
* Report paint time inside the Event Timing API implementation (PerformanceObserver).
|
|
234
|
+
*/
|
|
235
|
+
export const enableReportEventPaintTime: Getter<boolean> = createNativeFlagGetter('enableReportEventPaintTime', false);
|
|
152
236
|
/**
|
|
153
237
|
* Dispatches state updates synchronously in Fabric (e.g.: updates the scroll position in the shadow tree synchronously from the main thread).
|
|
154
238
|
*/
|
|
@@ -157,14 +241,30 @@ export const enableSynchronousStateUpdates: Getter<boolean> = createNativeFlagGe
|
|
|
157
241
|
* Ensures that JavaScript always has a consistent view of the state of the UI (e.g.: commits done in other threads are not immediately propagated to JS during its execution).
|
|
158
242
|
*/
|
|
159
243
|
export const enableUIConsistency: Getter<boolean> = createNativeFlagGetter('enableUIConsistency', false);
|
|
244
|
+
/**
|
|
245
|
+
* Enables View Recycling. When enabled, individual ViewManagers must still opt-in.
|
|
246
|
+
*/
|
|
247
|
+
export const enableViewRecycling: Getter<boolean> = createNativeFlagGetter('enableViewRecycling', false);
|
|
248
|
+
/**
|
|
249
|
+
* When enabled, rawProps in Props will not include Yoga specific props.
|
|
250
|
+
*/
|
|
251
|
+
export const excludeYogaFromRawProps: Getter<boolean> = createNativeFlagGetter('excludeYogaFromRawProps', false);
|
|
252
|
+
/**
|
|
253
|
+
* Start image fetching during view preallocation instead of waiting for layout pass
|
|
254
|
+
*/
|
|
255
|
+
export const fetchImagesInViewPreallocation: Getter<boolean> = createNativeFlagGetter('fetchImagesInViewPreallocation', false);
|
|
256
|
+
/**
|
|
257
|
+
* When doing a smooth scroll animation, it stops setting the state with the final scroll position in Fabric before the animation starts.
|
|
258
|
+
*/
|
|
259
|
+
export const fixIncorrectScrollViewStateUpdateOnAndroid: Getter<boolean> = createNativeFlagGetter('fixIncorrectScrollViewStateUpdateOnAndroid', false);
|
|
160
260
|
/**
|
|
161
261
|
* Uses the default event priority instead of the discreet event priority by default when dispatching events from Fabric to React.
|
|
162
262
|
*/
|
|
163
263
|
export const fixMappingOfEventPrioritiesBetweenFabricAndReact: Getter<boolean> = createNativeFlagGetter('fixMappingOfEventPrioritiesBetweenFabricAndReact', false);
|
|
164
264
|
/**
|
|
165
|
-
*
|
|
265
|
+
* Enables a fix to prevent the possibility of state updates in Fabric being missed due to race conditions with previous state updates.
|
|
166
266
|
*/
|
|
167
|
-
export const
|
|
267
|
+
export const fixMissedFabricStateUpdatesOnAndroid: Getter<boolean> = createNativeFlagGetter('fixMissedFabricStateUpdatesOnAndroid', false);
|
|
168
268
|
/**
|
|
169
269
|
* Forces the mounting layer on Android to always batch mount items instead of dispatching them immediately. This might fix some crashes related to synchronous state updates, where some views dispatch state updates during mount.
|
|
170
270
|
*/
|
|
@@ -172,23 +272,35 @@ export const forceBatchingMountItemsOnAndroid: Getter<boolean> = createNativeFla
|
|
|
172
272
|
/**
|
|
173
273
|
* 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.
|
|
174
274
|
*/
|
|
175
|
-
export const fuseboxEnabledDebug: Getter<boolean> = createNativeFlagGetter('fuseboxEnabledDebug',
|
|
275
|
+
export const fuseboxEnabledDebug: Getter<boolean> = createNativeFlagGetter('fuseboxEnabledDebug', true);
|
|
176
276
|
/**
|
|
177
277
|
* 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.
|
|
178
278
|
*/
|
|
179
279
|
export const fuseboxEnabledRelease: Getter<boolean> = createNativeFlagGetter('fuseboxEnabledRelease', false);
|
|
280
|
+
/**
|
|
281
|
+
* Construct modules that requires eager init on the dedicate native modules thread
|
|
282
|
+
*/
|
|
283
|
+
export const initEagerTurboModulesOnNativeModulesQueueAndroid: Getter<boolean> = createNativeFlagGetter('initEagerTurboModulesOnNativeModulesQueueAndroid', false);
|
|
180
284
|
/**
|
|
181
285
|
* Only enqueue Choreographer calls if there is an ongoing animation, instead of enqueueing every frame.
|
|
182
286
|
*/
|
|
183
287
|
export const lazyAnimationCallbacks: Getter<boolean> = createNativeFlagGetter('lazyAnimationCallbacks', false);
|
|
184
288
|
/**
|
|
185
|
-
*
|
|
289
|
+
* Adds support for loading vector drawable assets in the Image component (only on Android)
|
|
186
290
|
*/
|
|
187
|
-
export const
|
|
291
|
+
export const loadVectorDrawablesOnImages: Getter<boolean> = createNativeFlagGetter('loadVectorDrawablesOnImages', false);
|
|
188
292
|
/**
|
|
189
293
|
* Propagate layout direction to Android views.
|
|
190
294
|
*/
|
|
191
295
|
export const setAndroidLayoutDirection: Getter<boolean> = createNativeFlagGetter('setAndroidLayoutDirection', false);
|
|
296
|
+
/**
|
|
297
|
+
* Enables storing js caller stack when creating promise in native module. This is useful in case of Promise rejection and tracing the cause.
|
|
298
|
+
*/
|
|
299
|
+
export const traceTurboModulePromiseRejectionsOnAndroid: Getter<boolean> = createNativeFlagGetter('traceTurboModulePromiseRejectionsOnAndroid', false);
|
|
300
|
+
/**
|
|
301
|
+
* Should this application enable the Fabric Interop Layer for Android? If yes, the application will behave so that it can accept non-Fabric components and render them on Fabric. This toggle is controlling extra logic such as custom event dispatching that are needed for the Fabric Interop Layer to work correctly.
|
|
302
|
+
*/
|
|
303
|
+
export const useFabricInterop: Getter<boolean> = createNativeFlagGetter('useFabricInterop', false);
|
|
192
304
|
/**
|
|
193
305
|
* Invoke callbacks immediately on the ReactInstance rather than going through a background thread for synchronization
|
|
194
306
|
*/
|
|
@@ -201,6 +313,14 @@ export const useModernRuntimeScheduler: Getter<boolean> = createNativeFlagGetter
|
|
|
201
313
|
* When enabled, the native view configs are used in bridgeless mode.
|
|
202
314
|
*/
|
|
203
315
|
export const useNativeViewConfigsInBridgelessMode: Getter<boolean> = createNativeFlagGetter('useNativeViewConfigsInBridgelessMode', false);
|
|
316
|
+
/**
|
|
317
|
+
* Use shared background drawing code for ReactImageView instead of using Fresco to manipulate the bitmap
|
|
318
|
+
*/
|
|
319
|
+
export const useNewReactImageViewBackgroundDrawing: Getter<boolean> = createNativeFlagGetter('useNewReactImageViewBackgroundDrawing', false);
|
|
320
|
+
/**
|
|
321
|
+
* Moves more of the work in view preallocation to the main thread to free up JS thread.
|
|
322
|
+
*/
|
|
323
|
+
export const useOptimisedViewPreallocationOnAndroid: Getter<boolean> = createNativeFlagGetter('useOptimisedViewPreallocationOnAndroid', false);
|
|
204
324
|
/**
|
|
205
325
|
* When enabled, cloning shadow nodes within react native will update the reference held by the current JS fiber tree.
|
|
206
326
|
*/
|
|
@@ -213,6 +333,10 @@ export const useRuntimeShadowNodeReferenceUpdateOnLayout: Getter<boolean> = crea
|
|
|
213
333
|
* When enabled, it uses optimised state reconciliation algorithm.
|
|
214
334
|
*/
|
|
215
335
|
export const useStateAlignmentMechanism: Getter<boolean> = createNativeFlagGetter('useStateAlignmentMechanism', false);
|
|
336
|
+
/**
|
|
337
|
+
* In Bridgeless mode, should legacy NativeModules use the TurboModule system?
|
|
338
|
+
*/
|
|
339
|
+
export const useTurboModuleInterop: Getter<boolean> = createNativeFlagGetter('useTurboModuleInterop', false);
|
|
216
340
|
|
|
217
341
|
/**
|
|
218
342
|
* Overrides the feature flags with the provided methods.
|
|
@@ -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<<9728234e0662758c72ba79b3cffbd4e5>>
|
|
8
8
|
* @flow strict-local
|
|
9
9
|
*/
|
|
10
10
|
|
|
@@ -24,30 +24,50 @@ import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboMod
|
|
|
24
24
|
|
|
25
25
|
export interface Spec extends TurboModule {
|
|
26
26
|
+commonTestFlag?: () => boolean;
|
|
27
|
-
+allowCollapsableChildren?: () => boolean;
|
|
28
27
|
+allowRecursiveCommitsWithSynchronousMountOnAndroid?: () => boolean;
|
|
29
28
|
+batchRenderingUpdatesInEventLoop?: () => boolean;
|
|
29
|
+
+changeOrderOfMountingInstructionsOnAndroid?: () => boolean;
|
|
30
|
+
+completeReactInstanceCreationOnBgThreadOnAndroid?: () => boolean;
|
|
30
31
|
+destroyFabricSurfacesInReactInstanceManager?: () => boolean;
|
|
31
|
-
+
|
|
32
|
+
+enableAlignItemsBaselineOnFabricIOS?: () => boolean;
|
|
33
|
+
+enableAndroidMixBlendModeProp?: () => boolean;
|
|
34
|
+
+enableBackgroundStyleApplicator?: () => boolean;
|
|
32
35
|
+enableCleanTextInputYogaNode?: () => boolean;
|
|
36
|
+
+enableEagerRootViewAttachment?: () => boolean;
|
|
37
|
+
+enableEventEmitterRetentionDuringGesturesOnAndroid?: () => boolean;
|
|
38
|
+
+enableFabricLogs?: () => boolean;
|
|
39
|
+
+enableFabricRendererExclusively?: () => boolean;
|
|
33
40
|
+enableGranularShadowTreeStateReconciliation?: () => boolean;
|
|
41
|
+
+enableLongTaskAPI?: () => boolean;
|
|
34
42
|
+enableMicrotasks?: () => boolean;
|
|
43
|
+
+enablePropsUpdateReconciliationAndroid?: () => boolean;
|
|
44
|
+
+enableReportEventPaintTime?: () => boolean;
|
|
35
45
|
+enableSynchronousStateUpdates?: () => boolean;
|
|
36
46
|
+enableUIConsistency?: () => boolean;
|
|
47
|
+
+enableViewRecycling?: () => boolean;
|
|
48
|
+
+excludeYogaFromRawProps?: () => boolean;
|
|
49
|
+
+fetchImagesInViewPreallocation?: () => boolean;
|
|
50
|
+
+fixIncorrectScrollViewStateUpdateOnAndroid?: () => boolean;
|
|
37
51
|
+fixMappingOfEventPrioritiesBetweenFabricAndReact?: () => boolean;
|
|
38
|
-
+
|
|
52
|
+
+fixMissedFabricStateUpdatesOnAndroid?: () => boolean;
|
|
39
53
|
+forceBatchingMountItemsOnAndroid?: () => boolean;
|
|
40
54
|
+fuseboxEnabledDebug?: () => boolean;
|
|
41
55
|
+fuseboxEnabledRelease?: () => boolean;
|
|
56
|
+
+initEagerTurboModulesOnNativeModulesQueueAndroid?: () => boolean;
|
|
42
57
|
+lazyAnimationCallbacks?: () => boolean;
|
|
43
|
-
+
|
|
58
|
+
+loadVectorDrawablesOnImages?: () => boolean;
|
|
44
59
|
+setAndroidLayoutDirection?: () => boolean;
|
|
60
|
+
+traceTurboModulePromiseRejectionsOnAndroid?: () => boolean;
|
|
61
|
+
+useFabricInterop?: () => boolean;
|
|
45
62
|
+useImmediateExecutorInAndroidBridgeless?: () => boolean;
|
|
46
63
|
+useModernRuntimeScheduler?: () => boolean;
|
|
47
64
|
+useNativeViewConfigsInBridgelessMode?: () => boolean;
|
|
65
|
+
+useNewReactImageViewBackgroundDrawing?: () => boolean;
|
|
66
|
+
+useOptimisedViewPreallocationOnAndroid?: () => boolean;
|
|
48
67
|
+useRuntimeShadowNodeReferenceUpdate?: () => boolean;
|
|
49
68
|
+useRuntimeShadowNodeReferenceUpdateOnLayout?: () => boolean;
|
|
50
69
|
+useStateAlignmentMechanism?: () => boolean;
|
|
70
|
+
+useTurboModuleInterop?: () => boolean;
|
|
51
71
|
}
|
|
52
72
|
|
|
53
73
|
const NativeReactNativeFeatureFlags: ?Spec = TurboModuleRegistry.get<Spec>(
|
|
@@ -0,0 +1,148 @@
|
|
|
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-local
|
|
8
|
+
* @format
|
|
9
|
+
* @oncall react_native
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
'use strict';
|
|
13
|
+
|
|
14
|
+
// $FlowFixMe[untyped-type-import] used as an opaque type
|
|
15
|
+
import type {Task} from 'scheduler';
|
|
16
|
+
// $FlowFixMe[untyped-type-import] used as an opaque type
|
|
17
|
+
import typeof Scheduler from 'scheduler';
|
|
18
|
+
|
|
19
|
+
import {useCallback, useEffect, useRef} from 'react';
|
|
20
|
+
|
|
21
|
+
type EffectStatus =
|
|
22
|
+
// The effect is scheduled but has not yet run. The cleanup function is from
|
|
23
|
+
// the last execution, if there was one. If the effect gets rescheduled, the
|
|
24
|
+
// cleanup function must be propagated so that it can run before the updated
|
|
25
|
+
// effect
|
|
26
|
+
| {
|
|
27
|
+
kind: 'scheduled',
|
|
28
|
+
// $FlowFixMe[value-as-type] Task is opaque
|
|
29
|
+
task: Task,
|
|
30
|
+
previousCleanup: null | (() => void),
|
|
31
|
+
}
|
|
32
|
+
// The effect has been executed and returned a cleanup function. If it ran
|
|
33
|
+
// but didn't return a cleanup function, the effect status is set to null.
|
|
34
|
+
| {
|
|
35
|
+
cleanup: () => void,
|
|
36
|
+
kind: 'executed',
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Similar to `useEffect`, this hook schedules a passive effect (@param fn) to
|
|
41
|
+
* run on mount and whenever the dependency array (@param deps) changes.
|
|
42
|
+
* However, unlike `useEffect` the effect is debounced so that it runs after
|
|
43
|
+
* a delay (idle priority callback), reseting if another render occurs. Another
|
|
44
|
+
* render can occur for example when a layout effect runs and sets state.
|
|
45
|
+
* Updates triggered in layout effects cause the next render to flush
|
|
46
|
+
* synchronously and will by default run passive effects first before the
|
|
47
|
+
* re-render (to flush effects with the original state), and then again after
|
|
48
|
+
* the re-render (to flush effects with the updated state).
|
|
49
|
+
*
|
|
50
|
+
* Instead, this hook will run the effect once per batched render, after it has
|
|
51
|
+
* committed/painted. The effect is scheduled at idle priority, and if another
|
|
52
|
+
* render occurs in the meantime it reschedules the effect. Thus the effect
|
|
53
|
+
* will only run when the component stops re-rendering. When the effect does
|
|
54
|
+
* run, it is guaranteed to be the latest version of the effect.
|
|
55
|
+
*
|
|
56
|
+
* @see https://react.dev/reference/react/useEffect for more on normal passive
|
|
57
|
+
* effect behavior.
|
|
58
|
+
*/
|
|
59
|
+
export default function useDebouncedEffectImplementation(
|
|
60
|
+
fn: () => void | (() => void),
|
|
61
|
+
deps?: ?$ReadOnlyArray<mixed>,
|
|
62
|
+
// $FlowFixMe[value-as-type] used as an opaque type
|
|
63
|
+
scheduler: Scheduler,
|
|
64
|
+
): void {
|
|
65
|
+
const statusRef = useRef<null | EffectStatus>(null);
|
|
66
|
+
|
|
67
|
+
const scheduleTask = useCallback(
|
|
68
|
+
(
|
|
69
|
+
effectFn: null | (() => void | (() => void)),
|
|
70
|
+
previousCleanup: null | (() => void),
|
|
71
|
+
): void => {
|
|
72
|
+
const status = statusRef.current;
|
|
73
|
+
if (status != null && status.kind === 'scheduled') {
|
|
74
|
+
scheduler.unstable_cancelCallback(status.task);
|
|
75
|
+
}
|
|
76
|
+
if (effectFn == null && previousCleanup == null) {
|
|
77
|
+
statusRef.current = null;
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const task = scheduler.unstable_scheduleCallback(
|
|
81
|
+
scheduler.unstable_IdlePriority,
|
|
82
|
+
() => {
|
|
83
|
+
if (previousCleanup != null) {
|
|
84
|
+
previousCleanup();
|
|
85
|
+
}
|
|
86
|
+
let cleanup = null;
|
|
87
|
+
if (effectFn != null) {
|
|
88
|
+
cleanup = effectFn() ?? null;
|
|
89
|
+
}
|
|
90
|
+
if (cleanup == null) {
|
|
91
|
+
statusRef.current = null;
|
|
92
|
+
} else {
|
|
93
|
+
statusRef.current = {
|
|
94
|
+
kind: 'executed',
|
|
95
|
+
cleanup,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
);
|
|
100
|
+
statusRef.current = {
|
|
101
|
+
kind: 'scheduled',
|
|
102
|
+
task,
|
|
103
|
+
previousCleanup,
|
|
104
|
+
};
|
|
105
|
+
},
|
|
106
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
107
|
+
[],
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
useEffect(() => {
|
|
111
|
+
const statusInEffect = statusRef.current;
|
|
112
|
+
if (statusInEffect == null) {
|
|
113
|
+
scheduleTask(fn, null);
|
|
114
|
+
} else if (statusInEffect.kind === 'scheduled') {
|
|
115
|
+
// Need to cancel & reschedule, maintaining the same cleanup function.
|
|
116
|
+
scheduleTask(fn, statusInEffect.previousCleanup);
|
|
117
|
+
} else {
|
|
118
|
+
// Already executed, we need to schedule a new task and call the cleanup
|
|
119
|
+
// function from the last execution
|
|
120
|
+
scheduleTask(fn, statusInEffect.cleanup);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return () => {
|
|
124
|
+
// Rather than immediately run cleanup, we schedule the cleanup task.
|
|
125
|
+
// If the effect is about to update, then we'll cancel this task and
|
|
126
|
+
// reschedule with both the cleanup and the new effect function (see above)
|
|
127
|
+
const statusAtCleanup = statusRef.current;
|
|
128
|
+
if (statusAtCleanup == null) {
|
|
129
|
+
// nothing to do, nothing is scheduled and if the task ran already, it
|
|
130
|
+
// didn't have a cleanup function
|
|
131
|
+
return;
|
|
132
|
+
} else if (statusAtCleanup.kind === 'scheduled') {
|
|
133
|
+
// The task is scheduled but has not yet run. Reschedule just the
|
|
134
|
+
// cleanup function (the effect function portion may be
|
|
135
|
+
// overridden momentarily if the effect is about to update, but that's
|
|
136
|
+
// okay).
|
|
137
|
+
// Note that if cleanup is null, this will just clear the pending task
|
|
138
|
+
// and not schedule a new one
|
|
139
|
+
scheduleTask(null, statusAtCleanup.previousCleanup);
|
|
140
|
+
} else {
|
|
141
|
+
// If kind === executed, then we know there is a cleanup function that
|
|
142
|
+
// still needs to run so schedule it
|
|
143
|
+
scheduleTask(null, statusAtCleanup.cleanup);
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
147
|
+
}, deps);
|
|
148
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
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-local
|
|
8
|
+
* @format
|
|
9
|
+
* @oncall react_native
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
'use strict';
|
|
13
|
+
|
|
14
|
+
import useDebouncedEffectImplementation from './DebouncedEffectImplementation';
|
|
15
|
+
// $FlowFixMe[untyped-import] used as an opaque type
|
|
16
|
+
import Scheduler from 'scheduler';
|
|
17
|
+
|
|
18
|
+
export default function useDebouncedEffect(
|
|
19
|
+
fn: () => void | (() => void),
|
|
20
|
+
deps?: ?$ReadOnlyArray<mixed>,
|
|
21
|
+
): void {
|
|
22
|
+
return useDebouncedEffectImplementation(fn, deps, Scheduler);
|
|
23
|
+
}
|
|
@@ -8,11 +8,12 @@
|
|
|
8
8
|
* @flow strict
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
import type {ExtendedError} from '../../../../Libraries/Core/ExtendedError';
|
|
12
12
|
|
|
13
|
-
import
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
import {
|
|
14
|
+
SyntheticError,
|
|
15
|
+
handleException,
|
|
16
|
+
} from '../../../../Libraries/Core/ExceptionsManager';
|
|
16
17
|
|
|
17
18
|
type ErrorInfo = {
|
|
18
19
|
+componentStack?: ?string,
|
|
@@ -28,14 +29,17 @@ export function onUncaughtError(errorValue: mixed, errorInfo: ErrorInfo): void {
|
|
|
28
29
|
if (errorValue instanceof Error) {
|
|
29
30
|
/* $FlowFixMe[class-object-subtyping] added when improving typing for
|
|
30
31
|
* this parameters */
|
|
32
|
+
// $FlowFixMe[incompatible-cast]
|
|
31
33
|
error = (errorValue: ExtendedError);
|
|
32
34
|
} else if (typeof errorValue === 'string') {
|
|
33
35
|
/* $FlowFixMe[class-object-subtyping] added when improving typing for
|
|
34
36
|
* this parameters */
|
|
37
|
+
// $FlowFixMe[incompatible-cast]
|
|
35
38
|
error = (new SyntheticError(errorValue): ExtendedError);
|
|
36
39
|
} else {
|
|
37
40
|
/* $FlowFixMe[class-object-subtyping] added when improving typing for
|
|
38
41
|
* this parameters */
|
|
42
|
+
// $FlowFixMe[incompatible-cast]
|
|
39
43
|
error = (new SyntheticError('Unspecified error'): ExtendedError);
|
|
40
44
|
}
|
|
41
45
|
try {
|
|
@@ -58,14 +62,17 @@ export function onCaughtError(errorValue: mixed, errorInfo: ErrorInfo): void {
|
|
|
58
62
|
if (errorValue instanceof Error) {
|
|
59
63
|
/* $FlowFixMe[class-object-subtyping] added when improving typing for
|
|
60
64
|
* this parameters */
|
|
65
|
+
// $FlowFixMe[incompatible-cast]
|
|
61
66
|
error = (errorValue: ExtendedError);
|
|
62
67
|
} else if (typeof errorValue === 'string') {
|
|
63
68
|
/* $FlowFixMe[class-object-subtyping] added when improving typing for
|
|
64
69
|
* this parameters */
|
|
70
|
+
// $FlowFixMe[incompatible-cast]
|
|
65
71
|
error = (new SyntheticError(errorValue): ExtendedError);
|
|
66
72
|
} else {
|
|
67
73
|
/* $FlowFixMe[class-object-subtyping] added when improving typing for
|
|
68
74
|
* this parameters */
|
|
75
|
+
// $FlowFixMe[incompatible-cast]
|
|
69
76
|
error = (new SyntheticError('Unspecified error'): ExtendedError);
|
|
70
77
|
}
|
|
71
78
|
try {
|
|
@@ -91,14 +98,17 @@ export function onRecoverableError(
|
|
|
91
98
|
if (errorValue instanceof Error) {
|
|
92
99
|
/* $FlowFixMe[class-object-subtyping] added when improving typing for
|
|
93
100
|
* this parameters */
|
|
101
|
+
// $FlowFixMe[incompatible-cast]
|
|
94
102
|
error = (errorValue: ExtendedError);
|
|
95
103
|
} else if (typeof errorValue === 'string') {
|
|
96
104
|
/* $FlowFixMe[class-object-subtyping] added when improving typing for
|
|
97
105
|
* this parameters */
|
|
106
|
+
// $FlowFixMe[incompatible-cast]
|
|
98
107
|
error = (new SyntheticError(errorValue): ExtendedError);
|
|
99
108
|
} else {
|
|
100
109
|
/* $FlowFixMe[class-object-subtyping] added when improving typing for
|
|
101
110
|
* this parameters */
|
|
111
|
+
// $FlowFixMe[incompatible-cast]
|
|
102
112
|
error = (new SyntheticError('Unspecified error'): ExtendedError);
|
|
103
113
|
}
|
|
104
114
|
try {
|
|
@@ -0,0 +1,28 @@
|
|
|
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 DOMRect from '../webapis/dom/geometry/DOMRect';
|
|
12
|
+
import DOMRectReadOnly from '../webapis/dom/geometry/DOMRectReadOnly';
|
|
13
|
+
|
|
14
|
+
let initialized = false;
|
|
15
|
+
|
|
16
|
+
export default function setUpDOM() {
|
|
17
|
+
if (initialized) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
initialized = true;
|
|
22
|
+
|
|
23
|
+
// $FlowExpectedError[cannot-write] The global isn't writable anywhere but here, where we define it
|
|
24
|
+
global.DOMRect = DOMRect;
|
|
25
|
+
|
|
26
|
+
// $FlowExpectedError[cannot-write] The global isn't writable anywhere but here, where we define it
|
|
27
|
+
global.DOMRectReadOnly = DOMRectReadOnly;
|
|
28
|
+
}
|