@office-iss/react-native-win32 0.0.0-canary.259 → 0.0.0-canary.261

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/.flowconfig +4 -3
  2. package/CHANGELOG.json +31 -1
  3. package/CHANGELOG.md +20 -4
  4. package/Libraries/Animated/AnimatedImplementation.js +7 -7
  5. package/Libraries/Animated/animations/Animation.js +10 -0
  6. package/Libraries/Animated/animations/TimingAnimation.js +1 -0
  7. package/Libraries/Animated/components/AnimatedScrollView.js +2 -2
  8. package/Libraries/Animated/createAnimatedComponent.js +1 -1
  9. package/Libraries/Animated/useAnimatedProps.js +71 -4
  10. package/Libraries/Blob/FileReader.js +1 -1
  11. package/Libraries/Blob/URL.js +2 -62
  12. package/Libraries/Blob/URLSearchParams.js +71 -0
  13. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +1 -1
  14. package/Libraries/Components/RefreshControl/__mocks__/RefreshControlMock.js +1 -1
  15. package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +3 -0
  16. package/Libraries/Components/ScrollView/ScrollView.js +5 -5
  17. package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +3 -3
  18. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +1 -1
  19. package/Libraries/Components/StatusBar/StatusBar.js +3 -1
  20. package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +3 -0
  21. package/Libraries/Components/TextInput/TextInput.d.ts +32 -2
  22. package/Libraries/Components/TextInput/TextInput.js +19 -10
  23. package/Libraries/Components/TextInput/TextInput.win32.js +19 -10
  24. package/Libraries/Components/View/ReactNativeStyleAttributes.js +11 -0
  25. package/Libraries/Components/View/ReactNativeViewAttributes.js +2 -0
  26. package/Libraries/Components/View/ReactNativeViewAttributes.win32.js +2 -0
  27. package/Libraries/Components/View/ViewAccessibility.d.ts +15 -0
  28. package/Libraries/Components/View/ViewNativeComponent.js +6 -0
  29. package/Libraries/Components/View/ViewPropTypes.js +14 -0
  30. package/Libraries/Components/View/ViewPropTypes.win32.js +14 -0
  31. package/Libraries/Core/InitializeCore.js +1 -1
  32. package/Libraries/Core/ReactNativeVersion.js +1 -1
  33. package/Libraries/Core/setUpErrorHandling.js +7 -1
  34. package/Libraries/Image/AssetSourceResolver.js +28 -1
  35. package/Libraries/Image/Image.android.js +9 -14
  36. package/Libraries/Image/Image.ios.js +11 -22
  37. package/Libraries/Image/Image.win32.js +10 -21
  38. package/Libraries/Image/ImageBackground.js +1 -8
  39. package/Libraries/Image/ImageUtils.js +9 -9
  40. package/Libraries/Image/ImageViewNativeComponent.js +3 -0
  41. package/Libraries/Inspector/NetworkOverlay.js +1 -1
  42. package/Libraries/Lists/FlatList.js +1 -1
  43. package/Libraries/Lists/SectionList.js +1 -1
  44. package/Libraries/Lists/SectionListModern.js +3 -3
  45. package/Libraries/LogBox/Data/LogBoxData.js +30 -4
  46. package/Libraries/NativeComponent/BaseViewConfig.android.js +1 -0
  47. package/Libraries/NativeComponent/BaseViewConfig.ios.js +4 -0
  48. package/Libraries/NativeComponent/BaseViewConfig.win32.js +4 -0
  49. package/Libraries/NativeComponent/NativeComponentRegistry.js +13 -20
  50. package/Libraries/NativeComponent/StaticViewConfigValidator.js +0 -21
  51. package/Libraries/Network/XMLHttpRequest.js +4 -2
  52. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +1 -1
  53. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +5 -5
  54. package/Libraries/ReactNative/RendererImplementation.js +26 -4
  55. package/Libraries/ReactNative/getNativeComponentAttributes.js +8 -0
  56. package/Libraries/Renderer/shims/ReactNativeTypes.js +9 -4
  57. package/Libraries/StyleSheet/StyleSheet.js +1 -1
  58. package/Libraries/StyleSheet/StyleSheet.win32.js +1 -1
  59. package/Libraries/StyleSheet/StyleSheetTypes.d.ts +11 -0
  60. package/Libraries/StyleSheet/StyleSheetTypes.js +14 -2
  61. package/Libraries/StyleSheet/processBackgroundImage.js +384 -0
  62. package/Libraries/StyleSheet/processFilter.js +4 -4
  63. package/Libraries/Text/Text.js +7 -6
  64. package/Libraries/Text/Text.win32.js +7 -6
  65. package/Libraries/Text/TextNativeComponent.js +7 -0
  66. package/Libraries/Text/TextNativeComponent.win32.js +7 -0
  67. package/Libraries/Utilities/Appearance.js +65 -73
  68. package/Libraries/Utilities/DevLoadingView.js +2 -4
  69. package/Libraries/Utilities/ReactNativeTestTools.js +1 -1
  70. package/Libraries/Utilities/stringifyViewConfig.js +22 -0
  71. package/Libraries/Utilities/useColorScheme.js +3 -3
  72. package/Libraries/WebSocket/WebSocket.js +1 -1
  73. package/flow/jest.js +2 -2
  74. package/index.js +2 -1
  75. package/index.win32.js +2 -1
  76. package/jest/mockModal.js +1 -3
  77. package/jest/mockScrollView.js +1 -1
  78. package/jest/renderer.js +2 -2
  79. package/jest/setup.js +8 -12
  80. package/overrides.json +12 -12
  81. package/package.json +14 -14
  82. package/src/private/{core/components → components}/HScrollViewNativeComponents.js +8 -8
  83. package/src/private/{core/components → components}/VScrollViewNativeComponents.js +7 -7
  84. package/src/private/{core/components → components}/useSyncOnScroll.js +2 -2
  85. package/src/private/featureflags/ReactNativeFeatureFlags.js +93 -10
  86. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +16 -3
  87. package/src/private/hooks/DebouncedEffectImplementation.js +148 -0
  88. package/src/private/hooks/useDebouncedEffect.js +23 -0
  89. package/{Libraries/Core → src/private/renderer/errorhandling}/ErrorHandlers.js +5 -4
  90. package/src/private/setup/setUpDOM.js +28 -0
  91. package/src/private/setup/setUpIntersectionObserver.js +27 -0
  92. package/src/private/setup/setUpMutationObserver.js +26 -0
  93. package/src/private/setup/setUpPerformanceObserver.js +64 -0
  94. package/src/private/specs/modules/NativeAppearance.js +3 -3
  95. package/src/private/specs/modules/NativeDebuggerSessionObserver.js +23 -0
  96. package/src/private/webapis/dom/nodes/ReadOnlyNode.js +6 -4
  97. package/{Libraries/IntersectionObserver → src/private/webapis/intersectionobserver}/IntersectionObserver.js +5 -3
  98. package/{Libraries/IntersectionObserver → src/private/webapis/intersectionobserver}/IntersectionObserverEntry.js +3 -3
  99. package/{Libraries/IntersectionObserver → src/private/webapis/intersectionobserver}/IntersectionObserverManager.js +14 -17
  100. package/src/private/{specs/modules → webapis/intersectionobserver/specs}/NativeIntersectionObserver.js +2 -2
  101. package/{Libraries/IntersectionObserver → src/private/webapis/intersectionobserver/specs}/__mocks__/NativeIntersectionObserver.js +4 -4
  102. package/{Libraries/MutationObserver → src/private/webapis/mutationobserver}/MutationObserver.js +5 -3
  103. package/{Libraries/MutationObserver → src/private/webapis/mutationobserver}/MutationObserverManager.js +24 -15
  104. package/{Libraries/MutationObserver → src/private/webapis/mutationobserver}/MutationRecord.js +4 -6
  105. package/src/private/{specs/modules → webapis/mutationobserver/specs}/NativeMutationObserver.js +2 -2
  106. package/{Libraries/MutationObserver → src/private/webapis/mutationobserver/specs}/__mocks__/NativeMutationObserver.js +5 -5
  107. package/src/private/webapis/performance/{EventCounts.js → EventTiming.js} +65 -3
  108. package/src/private/webapis/performance/LongTasks.js +39 -0
  109. package/src/private/webapis/performance/Performance.js +22 -9
  110. package/src/private/webapis/performance/PerformanceEntry.js +35 -17
  111. package/src/private/webapis/performance/PerformanceObserver.js +29 -43
  112. package/src/private/webapis/performance/RawPerformanceEntry.js +19 -1
  113. package/src/private/webapis/performance/UserTiming.js +17 -12
  114. package/src/private/webapis/performance/specs/NativePerformanceObserver.js +1 -1
  115. package/src-win/Libraries/Components/View/ViewAccessibility.d.ts +15 -0
  116. package/types/experimental.d.ts +10 -2
  117. package/Libraries/Core/setUpIntersectionObserver.js +0 -16
  118. package/Libraries/Core/setUpMutationObserver.js +0 -16
  119. package/Libraries/Core/setUpPerformanceObserver.js +0 -18
  120. package/Libraries/IntersectionObserver/NativeIntersectionObserver.js +0 -13
  121. package/Libraries/MutationObserver/NativeMutationObserver.js +0 -13
  122. package/Libraries/Utilities/verifyComponentAttributeEquivalence.js +0 -135
  123. package/src/private/core/setUpDOM.js +0 -18
  124. package/src/private/webapis/performance/PerformanceEventTiming.js +0 -55
  125. /package/src/private/{core → styles}/composeStyles.js +0 -0
@@ -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<<7421319910b210753a1eddcf079aa151>>
7
+ * @generated SignedSource<<3c32ce3847859db45d2e8bafb3cc31a1>>
8
8
  * @flow strict-local
9
9
  */
10
10
 
@@ -30,8 +30,11 @@ export type ReactNativeFeatureFlagsJsOnly = {
30
30
  animatedShouldDebounceQueueFlush: Getter<boolean>,
31
31
  animatedShouldUseSingleOp: Getter<boolean>,
32
32
  enableAccessToHostTreeInFabric: Getter<boolean>,
33
+ enableOptimisedVirtualizedCells: Getter<boolean>,
33
34
  isLayoutAnimationEnabled: Getter<boolean>,
35
+ shouldSkipStateUpdatesForLoopingAnimations: Getter<boolean>,
34
36
  shouldUseAnimatedObjectForTransform: Getter<boolean>,
37
+ shouldUseDebouncedEffectsForAnimated: Getter<boolean>,
35
38
  shouldUseRemoveClippedSubviewsAsDefaultOnIOS: Getter<boolean>,
36
39
  shouldUseSetNativePropsInFabric: Getter<boolean>,
37
40
  shouldUseSetNativePropsInNativeAnimationsInFabric: Getter<boolean>,
@@ -44,19 +47,28 @@ export type ReactNativeFeatureFlagsJsOnlyOverrides = Partial<ReactNativeFeatureF
44
47
  export type ReactNativeFeatureFlags = {
45
48
  ...ReactNativeFeatureFlagsJsOnly,
46
49
  commonTestFlag: Getter<boolean>,
47
- allowCollapsableChildren: Getter<boolean>,
48
50
  allowRecursiveCommitsWithSynchronousMountOnAndroid: Getter<boolean>,
49
51
  batchRenderingUpdatesInEventLoop: Getter<boolean>,
50
- changeOrderOfMountingInstructionsOnAndroid: Getter<boolean>,
52
+ completeReactInstanceCreationOnBgThreadOnAndroid: Getter<boolean>,
51
53
  destroyFabricSurfacesInReactInstanceManager: Getter<boolean>,
52
54
  enableAlignItemsBaselineOnFabricIOS: Getter<boolean>,
55
+ enableAndroidMixBlendModeProp: Getter<boolean>,
56
+ enableBackgroundStyleApplicator: Getter<boolean>,
53
57
  enableCleanTextInputYogaNode: Getter<boolean>,
58
+ enableEagerRootViewAttachment: Getter<boolean>,
59
+ enableEventEmitterRetentionDuringGesturesOnAndroid: Getter<boolean>,
60
+ enableFabricLogs: Getter<boolean>,
61
+ enableFabricRendererExclusively: Getter<boolean>,
54
62
  enableGranularShadowTreeStateReconciliation: Getter<boolean>,
63
+ enableLayoutAnimationsOnIOS: Getter<boolean>,
55
64
  enableLongTaskAPI: Getter<boolean>,
56
65
  enableMicrotasks: Getter<boolean>,
57
66
  enablePropsUpdateReconciliationAndroid: Getter<boolean>,
67
+ enableReportEventPaintTime: Getter<boolean>,
58
68
  enableSynchronousStateUpdates: Getter<boolean>,
59
69
  enableUIConsistency: Getter<boolean>,
70
+ enableViewRecycling: Getter<boolean>,
71
+ excludeYogaFromRawProps: Getter<boolean>,
60
72
  fetchImagesInViewPreallocation: Getter<boolean>,
61
73
  fixIncorrectScrollViewStateUpdateOnAndroid: Getter<boolean>,
62
74
  fixMappingOfEventPrioritiesBetweenFabricAndReact: Getter<boolean>,
@@ -68,13 +80,17 @@ export type ReactNativeFeatureFlags = {
68
80
  lazyAnimationCallbacks: Getter<boolean>,
69
81
  loadVectorDrawablesOnImages: Getter<boolean>,
70
82
  setAndroidLayoutDirection: Getter<boolean>,
83
+ traceTurboModulePromiseRejectionsOnAndroid: Getter<boolean>,
84
+ useFabricInterop: Getter<boolean>,
71
85
  useImmediateExecutorInAndroidBridgeless: Getter<boolean>,
72
86
  useModernRuntimeScheduler: Getter<boolean>,
73
87
  useNativeViewConfigsInBridgelessMode: Getter<boolean>,
74
88
  useNewReactImageViewBackgroundDrawing: Getter<boolean>,
89
+ useOptimisedViewPreallocationOnAndroid: Getter<boolean>,
75
90
  useRuntimeShadowNodeReferenceUpdate: Getter<boolean>,
76
91
  useRuntimeShadowNodeReferenceUpdateOnLayout: Getter<boolean>,
77
92
  useStateAlignmentMechanism: Getter<boolean>,
93
+ useTurboModuleInterop: Getter<boolean>,
78
94
  }
79
95
 
80
96
  /**
@@ -97,16 +113,31 @@ export const animatedShouldUseSingleOp: Getter<boolean> = createJavaScriptFlagGe
97
113
  */
98
114
  export const enableAccessToHostTreeInFabric: Getter<boolean> = createJavaScriptFlagGetter('enableAccessToHostTreeInFabric', false);
99
115
 
116
+ /**
117
+ * Removing unnecessary rerenders Virtualized cells after any rerenders of Virualized list. Works with strict=true option
118
+ */
119
+ export const enableOptimisedVirtualizedCells: Getter<boolean> = createJavaScriptFlagGetter('enableOptimisedVirtualizedCells', false);
120
+
100
121
  /**
101
122
  * Function used to enable / disabled Layout Animations in React Native.
102
123
  */
103
124
  export const isLayoutAnimationEnabled: Getter<boolean> = createJavaScriptFlagGetter('isLayoutAnimationEnabled', true);
104
125
 
126
+ /**
127
+ * If the animation is within Animated.loop, we do not send state updates to React.
128
+ */
129
+ export const shouldSkipStateUpdatesForLoopingAnimations: Getter<boolean> = createJavaScriptFlagGetter('shouldSkipStateUpdatesForLoopingAnimations', false);
130
+
105
131
  /**
106
132
  * Enables use of AnimatedObject for animating transform values.
107
133
  */
108
134
  export const shouldUseAnimatedObjectForTransform: Getter<boolean> = createJavaScriptFlagGetter('shouldUseAnimatedObjectForTransform', false);
109
135
 
136
+ /**
137
+ * Use new `useDebouncedEffects` hook for manging animated props lifecycle.
138
+ */
139
+ export const shouldUseDebouncedEffectsForAnimated: Getter<boolean> = createJavaScriptFlagGetter('shouldUseDebouncedEffectsForAnimated', false);
140
+
110
141
  /**
111
142
  * removeClippedSubviews prop will be used as the default in FlatList on iOS to match Android
112
143
  */
@@ -136,10 +167,6 @@ export const useRefsForTextInputState: Getter<boolean> = createJavaScriptFlagGet
136
167
  * Common flag for testing. Do NOT modify.
137
168
  */
138
169
  export const commonTestFlag: Getter<boolean> = createNativeFlagGetter('commonTestFlag', false);
139
- /**
140
- * Enables the differentiator to understand the "collapsableChildren" prop
141
- */
142
- export const allowCollapsableChildren: Getter<boolean> = createNativeFlagGetter('allowCollapsableChildren', true);
143
170
  /**
144
171
  * Adds support for recursively processing commits that mount synchronously (Android only).
145
172
  */
@@ -149,9 +176,9 @@ export const allowRecursiveCommitsWithSynchronousMountOnAndroid: Getter<boolean>
149
176
  */
150
177
  export const batchRenderingUpdatesInEventLoop: Getter<boolean> = createNativeFlagGetter('batchRenderingUpdatesInEventLoop', false);
151
178
  /**
152
- * When enabled, insert of views on Android will be moved from the beginning of the IntBufferBatchMountItem to be after layout updates.
179
+ * Do not wait for a main-thread dispatch to complete init to start executing work on the JS thread on Android
153
180
  */
154
- export const changeOrderOfMountingInstructionsOnAndroid: Getter<boolean> = createNativeFlagGetter('changeOrderOfMountingInstructionsOnAndroid', false);
181
+ export const completeReactInstanceCreationOnBgThreadOnAndroid: Getter<boolean> = createNativeFlagGetter('completeReactInstanceCreationOnBgThreadOnAndroid', false);
155
182
  /**
156
183
  * When enabled, ReactInstanceManager will clean up Fabric surfaces on destroy().
157
184
  */
@@ -160,14 +187,42 @@ export const destroyFabricSurfacesInReactInstanceManager: Getter<boolean> = crea
160
187
  * Kill-switch to turn off support for aling-items:baseline on Fabric iOS.
161
188
  */
162
189
  export const enableAlignItemsBaselineOnFabricIOS: Getter<boolean> = createNativeFlagGetter('enableAlignItemsBaselineOnFabricIOS', true);
190
+ /**
191
+ * Enables mix-blend-mode prop on Android.
192
+ */
193
+ export const enableAndroidMixBlendModeProp: Getter<boolean> = createNativeFlagGetter('enableAndroidMixBlendModeProp', false);
194
+ /**
195
+ * Use BackgroundStyleApplicator in place of other background/border drawing code
196
+ */
197
+ export const enableBackgroundStyleApplicator: Getter<boolean> = createNativeFlagGetter('enableBackgroundStyleApplicator', true);
163
198
  /**
164
199
  * Clean yoga node when <TextInput /> does not change.
165
200
  */
166
201
  export const enableCleanTextInputYogaNode: Getter<boolean> = createNativeFlagGetter('enableCleanTextInputYogaNode', false);
202
+ /**
203
+ * Feature flag to configure eager attachment of the root view/initialisation of the JS code.
204
+ */
205
+ export const enableEagerRootViewAttachment: Getter<boolean> = createNativeFlagGetter('enableEagerRootViewAttachment', false);
206
+ /**
207
+ * Enables the retention of EventEmitterWrapper on Android till the touch gesture is over to fix a bug on pressable (#44610)
208
+ */
209
+ export const enableEventEmitterRetentionDuringGesturesOnAndroid: Getter<boolean> = createNativeFlagGetter('enableEventEmitterRetentionDuringGesturesOnAndroid', false);
210
+ /**
211
+ * This feature flag enables logs for Fabric.
212
+ */
213
+ export const enableFabricLogs: Getter<boolean> = createNativeFlagGetter('enableFabricLogs', false);
214
+ /**
215
+ * 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.
216
+ */
217
+ export const enableFabricRendererExclusively: Getter<boolean> = createNativeFlagGetter('enableFabricRendererExclusively', false);
167
218
  /**
168
219
  * When enabled, the renderer would only fail commits when they propagate state and the last commit that updated state changed before committing.
169
220
  */
170
221
  export const enableGranularShadowTreeStateReconciliation: Getter<boolean> = createNativeFlagGetter('enableGranularShadowTreeStateReconciliation', false);
222
+ /**
223
+ * When enabled, LayoutAnimations API will animate state changes on iOS.
224
+ */
225
+ export const enableLayoutAnimationsOnIOS: Getter<boolean> = createNativeFlagGetter('enableLayoutAnimationsOnIOS', true);
171
226
  /**
172
227
  * Enables the reporting of long tasks through `PerformanceObserver`. Only works if the event loop is enabled.
173
228
  */
@@ -180,6 +235,10 @@ export const enableMicrotasks: Getter<boolean> = createNativeFlagGetter('enableM
180
235
  * When enabled, Android will receive prop updates based on the differences between the last rendered shadow node and the last committed shadow node.
181
236
  */
182
237
  export const enablePropsUpdateReconciliationAndroid: Getter<boolean> = createNativeFlagGetter('enablePropsUpdateReconciliationAndroid', false);
238
+ /**
239
+ * Report paint time inside the Event Timing API implementation (PerformanceObserver).
240
+ */
241
+ export const enableReportEventPaintTime: Getter<boolean> = createNativeFlagGetter('enableReportEventPaintTime', false);
183
242
  /**
184
243
  * Dispatches state updates synchronously in Fabric (e.g.: updates the scroll position in the shadow tree synchronously from the main thread).
185
244
  */
@@ -188,6 +247,14 @@ export const enableSynchronousStateUpdates: Getter<boolean> = createNativeFlagGe
188
247
  * 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).
189
248
  */
190
249
  export const enableUIConsistency: Getter<boolean> = createNativeFlagGetter('enableUIConsistency', false);
250
+ /**
251
+ * Enables View Recycling. When enabled, individual ViewManagers must still opt-in.
252
+ */
253
+ export const enableViewRecycling: Getter<boolean> = createNativeFlagGetter('enableViewRecycling', false);
254
+ /**
255
+ * When enabled, rawProps in Props will not include Yoga specific props.
256
+ */
257
+ export const excludeYogaFromRawProps: Getter<boolean> = createNativeFlagGetter('excludeYogaFromRawProps', false);
191
258
  /**
192
259
  * Start image fetching during view preallocation instead of waiting for layout pass
193
260
  */
@@ -231,7 +298,15 @@ export const loadVectorDrawablesOnImages: Getter<boolean> = createNativeFlagGett
231
298
  /**
232
299
  * Propagate layout direction to Android views.
233
300
  */
234
- export const setAndroidLayoutDirection: Getter<boolean> = createNativeFlagGetter('setAndroidLayoutDirection', true);
301
+ export const setAndroidLayoutDirection: Getter<boolean> = createNativeFlagGetter('setAndroidLayoutDirection', false);
302
+ /**
303
+ * Enables storing js caller stack when creating promise in native module. This is useful in case of Promise rejection and tracing the cause.
304
+ */
305
+ export const traceTurboModulePromiseRejectionsOnAndroid: Getter<boolean> = createNativeFlagGetter('traceTurboModulePromiseRejectionsOnAndroid', false);
306
+ /**
307
+ * 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.
308
+ */
309
+ export const useFabricInterop: Getter<boolean> = createNativeFlagGetter('useFabricInterop', false);
235
310
  /**
236
311
  * Invoke callbacks immediately on the ReactInstance rather than going through a background thread for synchronization
237
312
  */
@@ -248,6 +323,10 @@ export const useNativeViewConfigsInBridgelessMode: Getter<boolean> = createNativ
248
323
  * Use shared background drawing code for ReactImageView instead of using Fresco to manipulate the bitmap
249
324
  */
250
325
  export const useNewReactImageViewBackgroundDrawing: Getter<boolean> = createNativeFlagGetter('useNewReactImageViewBackgroundDrawing', false);
326
+ /**
327
+ * Moves more of the work in view preallocation to the main thread to free up JS thread.
328
+ */
329
+ export const useOptimisedViewPreallocationOnAndroid: Getter<boolean> = createNativeFlagGetter('useOptimisedViewPreallocationOnAndroid', false);
251
330
  /**
252
331
  * When enabled, cloning shadow nodes within react native will update the reference held by the current JS fiber tree.
253
332
  */
@@ -260,6 +339,10 @@ export const useRuntimeShadowNodeReferenceUpdateOnLayout: Getter<boolean> = crea
260
339
  * When enabled, it uses optimised state reconciliation algorithm.
261
340
  */
262
341
  export const useStateAlignmentMechanism: Getter<boolean> = createNativeFlagGetter('useStateAlignmentMechanism', false);
342
+ /**
343
+ * In Bridgeless mode, should legacy NativeModules use the TurboModule system?
344
+ */
345
+ export const useTurboModuleInterop: Getter<boolean> = createNativeFlagGetter('useTurboModuleInterop', false);
263
346
 
264
347
  /**
265
348
  * 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<<29f4ec3c941708dc99dd38adac52d6dc>>
7
+ * @generated SignedSource<<1f1710a12f6980b23bb6c0ece0060b59>>
8
8
  * @flow strict-local
9
9
  */
10
10
 
@@ -24,19 +24,28 @@ 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;
30
- +changeOrderOfMountingInstructionsOnAndroid?: () => boolean;
29
+ +completeReactInstanceCreationOnBgThreadOnAndroid?: () => boolean;
31
30
  +destroyFabricSurfacesInReactInstanceManager?: () => boolean;
32
31
  +enableAlignItemsBaselineOnFabricIOS?: () => boolean;
32
+ +enableAndroidMixBlendModeProp?: () => boolean;
33
+ +enableBackgroundStyleApplicator?: () => boolean;
33
34
  +enableCleanTextInputYogaNode?: () => boolean;
35
+ +enableEagerRootViewAttachment?: () => boolean;
36
+ +enableEventEmitterRetentionDuringGesturesOnAndroid?: () => boolean;
37
+ +enableFabricLogs?: () => boolean;
38
+ +enableFabricRendererExclusively?: () => boolean;
34
39
  +enableGranularShadowTreeStateReconciliation?: () => boolean;
40
+ +enableLayoutAnimationsOnIOS?: () => boolean;
35
41
  +enableLongTaskAPI?: () => boolean;
36
42
  +enableMicrotasks?: () => boolean;
37
43
  +enablePropsUpdateReconciliationAndroid?: () => boolean;
44
+ +enableReportEventPaintTime?: () => boolean;
38
45
  +enableSynchronousStateUpdates?: () => boolean;
39
46
  +enableUIConsistency?: () => boolean;
47
+ +enableViewRecycling?: () => boolean;
48
+ +excludeYogaFromRawProps?: () => boolean;
40
49
  +fetchImagesInViewPreallocation?: () => boolean;
41
50
  +fixIncorrectScrollViewStateUpdateOnAndroid?: () => boolean;
42
51
  +fixMappingOfEventPrioritiesBetweenFabricAndReact?: () => boolean;
@@ -48,13 +57,17 @@ export interface Spec extends TurboModule {
48
57
  +lazyAnimationCallbacks?: () => boolean;
49
58
  +loadVectorDrawablesOnImages?: () => boolean;
50
59
  +setAndroidLayoutDirection?: () => boolean;
60
+ +traceTurboModulePromiseRejectionsOnAndroid?: () => boolean;
61
+ +useFabricInterop?: () => boolean;
51
62
  +useImmediateExecutorInAndroidBridgeless?: () => boolean;
52
63
  +useModernRuntimeScheduler?: () => boolean;
53
64
  +useNativeViewConfigsInBridgelessMode?: () => boolean;
54
65
  +useNewReactImageViewBackgroundDrawing?: () => boolean;
66
+ +useOptimisedViewPreallocationOnAndroid?: () => boolean;
55
67
  +useRuntimeShadowNodeReferenceUpdate?: () => boolean;
56
68
  +useRuntimeShadowNodeReferenceUpdateOnLayout?: () => boolean;
57
69
  +useStateAlignmentMechanism?: () => boolean;
70
+ +useTurboModuleInterop?: () => boolean;
58
71
  }
59
72
 
60
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
- 'use strict';
11
+ import type {ExtendedError} from '../../../../Libraries/Core/ExtendedError';
12
12
 
13
- import type {ExtendedError} from './ExtendedError';
14
-
15
- import {SyntheticError, handleException} from './ExceptionsManager';
13
+ import {
14
+ SyntheticError,
15
+ handleException,
16
+ } from '../../../../Libraries/Core/ExceptionsManager';
16
17
 
17
18
  type ErrorInfo = {
18
19
  +componentStack?: ?string,
@@ -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
+ }
@@ -0,0 +1,27 @@
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
+ */
10
+
11
+ import {polyfillGlobal} from '../../../Libraries/Utilities/PolyfillFunctions';
12
+
13
+ let initialized = false;
14
+
15
+ export default function setUpIntersectionObserver() {
16
+ if (initialized) {
17
+ return;
18
+ }
19
+
20
+ initialized = true;
21
+
22
+ polyfillGlobal(
23
+ 'IntersectionObserver',
24
+ () =>
25
+ require('../webapis/intersectionobserver/IntersectionObserver').default,
26
+ );
27
+ }
@@ -0,0 +1,26 @@
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
+ */
10
+
11
+ import {polyfillGlobal} from '../../../Libraries/Utilities/PolyfillFunctions';
12
+
13
+ let initialized = false;
14
+
15
+ export default function setUpMutationObserver() {
16
+ if (initialized) {
17
+ return;
18
+ }
19
+
20
+ initialized = true;
21
+
22
+ polyfillGlobal(
23
+ 'MutationObserver',
24
+ () => require('../webapis/mutationobserver/MutationObserver').default,
25
+ );
26
+ }
@@ -0,0 +1,64 @@
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
+ */
10
+
11
+ import {polyfillGlobal} from '../../../Libraries/Utilities/PolyfillFunctions';
12
+
13
+ let initialized = false;
14
+
15
+ export default function setUpPerformanceObserver() {
16
+ if (initialized) {
17
+ return;
18
+ }
19
+
20
+ initialized = true;
21
+
22
+ polyfillGlobal(
23
+ 'PerformanceObserver',
24
+ () =>
25
+ require('../webapis/performance/PerformanceObserver').PerformanceObserver,
26
+ );
27
+
28
+ polyfillGlobal(
29
+ 'PerformanceObserverEntryList',
30
+ () =>
31
+ require('../webapis/performance/PerformanceObserver')
32
+ .PerformanceObserverEntryList,
33
+ );
34
+
35
+ polyfillGlobal(
36
+ 'PerformanceEntry',
37
+ () => require('../webapis/performance/PerformanceEntry').PerformanceEntry,
38
+ );
39
+
40
+ polyfillGlobal(
41
+ 'PerformanceMark',
42
+ () => require('../webapis/performance/UserTiming').PerformanceMark,
43
+ );
44
+
45
+ polyfillGlobal(
46
+ 'PerformanceMeasure',
47
+ () => require('../webapis/performance/UserTiming').PerformanceMeasure,
48
+ );
49
+
50
+ polyfillGlobal(
51
+ 'PerformanceEventTiming',
52
+ () => require('../webapis/performance/EventTiming').PerformanceEventTiming,
53
+ );
54
+
55
+ polyfillGlobal(
56
+ 'TaskAttributionTiming',
57
+ () => require('../webapis/performance/LongTasks').TaskAttributionTiming,
58
+ );
59
+
60
+ polyfillGlobal(
61
+ 'PerformanceLongTaskTiming',
62
+ () => require('../webapis/performance/LongTasks').PerformanceLongTaskTiming,
63
+ );
64
+ }
@@ -14,19 +14,19 @@ import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboMod
14
14
 
15
15
  export type ColorSchemeName = 'light' | 'dark';
16
16
 
17
- export type AppearancePreferences = {|
17
+ export type AppearancePreferences = {
18
18
  // TODO: (hramos) T52919652 Use ?ColorSchemeName once codegen supports union
19
19
  // types.
20
20
  /* 'light' | 'dark' */
21
21
  colorScheme?: ?string,
22
- |};
22
+ };
23
23
 
24
24
  export interface Spec extends TurboModule {
25
25
  // TODO: (hramos) T52919652 Use ?ColorSchemeName once codegen supports union
26
26
  // types.
27
27
  /* 'light' | 'dark' */
28
28
  +getColorScheme: () => ?string;
29
- +setColorScheme?: (colorScheme: string) => void;
29
+ +setColorScheme: (colorScheme: string) => void;
30
30
 
31
31
  // RCTEventEmitter
32
32
  +addListener: (eventName: string) => void;
@@ -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
8
+ * @format
9
+ * @oncall react_native
10
+ */
11
+
12
+ import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport';
13
+
14
+ import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry';
15
+
16
+ export interface Spec extends TurboModule {
17
+ +hasActiveSession: () => boolean;
18
+ +subscribe: (callback: (hasActiveSession: boolean) => void) => () => void;
19
+ }
20
+
21
+ export default (TurboModuleRegistry.get<Spec>(
22
+ 'NativeDebuggerSessionObserverCxx',
23
+ ): ?Spec);