@office-iss/react-native-win32 0.0.0-canary.296 → 0.0.0-canary.297

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 (141) hide show
  1. package/.flowconfig +3 -1
  2. package/CHANGELOG.json +22 -1
  3. package/CHANGELOG.md +13 -4
  4. package/Libraries/Animated/Animated.js +0 -1
  5. package/Libraries/Animated/Animated.js.flow +0 -1
  6. package/Libraries/Animated/AnimatedExports.js +0 -1
  7. package/Libraries/Animated/AnimatedExports.js.flow +1 -2
  8. package/Libraries/Animated/animations/Animation.js +5 -2
  9. package/Libraries/Animated/components/AnimatedScrollView.js +53 -52
  10. package/Libraries/Animated/createAnimatedComponent.js +37 -33
  11. package/Libraries/Animated/nodes/AnimatedObject.js +2 -3
  12. package/Libraries/Animated/nodes/AnimatedProps.js +1 -1
  13. package/Libraries/Animated/shouldUseTurboAnimatedModule.js +6 -1
  14. package/Libraries/AppState/AppState.js +6 -1
  15. package/Libraries/Components/ActivityIndicator/ActivityIndicator.js +19 -18
  16. package/Libraries/Components/Button.js +2 -2
  17. package/Libraries/Components/Button.win32.js +2 -2
  18. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +2 -3
  19. package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +2 -1
  20. package/Libraries/Components/LayoutConformance/LayoutConformance.js +0 -1
  21. package/Libraries/Components/Pressable/Pressable.js +9 -6
  22. package/Libraries/Components/Pressable/Pressable.win32.js +9 -6
  23. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js +14 -13
  24. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.js +13 -1
  25. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroidTypes.js +29 -20
  26. package/Libraries/Components/ScrollView/ScrollView.d.ts +9 -5
  27. package/Libraries/Components/ScrollView/ScrollView.js +18 -12
  28. package/Libraries/Components/ScrollView/ScrollViewContext.js +2 -1
  29. package/Libraries/Components/ScrollView/ScrollViewNativeComponentType.js +1 -1
  30. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +19 -6
  31. package/Libraries/Components/Switch/Switch.js +8 -2
  32. package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +1 -5
  33. package/Libraries/Components/TextInput/TextInput.flow.js +1 -5
  34. package/Libraries/Components/TextInput/TextInput.flow.win32.js +1 -5
  35. package/Libraries/Components/TextInput/TextInput.js +26 -25
  36. package/Libraries/Components/TextInput/TextInput.win32.js +27 -25
  37. package/Libraries/Components/Touchable/TouchableBounce.js +9 -3
  38. package/Libraries/Components/Touchable/TouchableHighlight.js +9 -4
  39. package/Libraries/Components/Touchable/TouchableNativeFeedback.js +2 -1
  40. package/Libraries/Components/Touchable/TouchableNativeFeedback.win32.js +2 -0
  41. package/Libraries/Components/Touchable/TouchableOpacity.js +7 -3
  42. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +2 -2
  43. package/Libraries/Components/View/View.js +111 -25
  44. package/Libraries/Core/Devtools/loadBundleFromServer.js +49 -7
  45. package/Libraries/Core/Devtools/loadBundleFromServer.win32.js +49 -7
  46. package/Libraries/Core/InitializeCore.js +1 -22
  47. package/Libraries/Core/ReactNativeVersion.js +3 -2
  48. package/Libraries/Debugging/DebuggingOverlay.js +6 -8
  49. package/Libraries/Debugging/DebuggingOverlayRegistry.js +0 -1
  50. package/Libraries/Debugging/useSubscribeToDebuggingOverlayRegistry.js +0 -1
  51. package/Libraries/EventEmitter/NativeEventEmitter.js +1 -1
  52. package/Libraries/Image/AssetRegistry.js +4 -10
  53. package/Libraries/Image/AssetSourceResolver.js +17 -4
  54. package/Libraries/Image/Image.android.js +112 -106
  55. package/Libraries/Image/Image.ios.js +10 -2
  56. package/Libraries/Image/Image.win32.js +11 -3
  57. package/Libraries/Image/ImageAnalyticsTagContext.js +2 -2
  58. package/Libraries/Image/RelativeImageStub.js +1 -0
  59. package/Libraries/Lists/FlatList.d.ts +9 -5
  60. package/Libraries/Lists/FlatList.js +1 -1
  61. package/Libraries/Lists/SectionListModern.js +9 -3
  62. package/Libraries/LogBox/UI/LogBoxButton.js +2 -1
  63. package/Libraries/LogBox/UI/LogBoxInspectorReactFrames.js +2 -1
  64. package/Libraries/LogBox/UI/LogBoxInspectorReactFrames.win32.js +2 -1
  65. package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js +3 -2
  66. package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.win32.js +3 -2
  67. package/Libraries/LogBox/UI/LogBoxInspectorStackFrames.js +2 -1
  68. package/Libraries/ReactNative/AppContainer-dev.js +4 -4
  69. package/Libraries/ReactNative/AppContainer-prod.js +0 -1
  70. package/Libraries/ReactNative/RootTag.js +2 -2
  71. package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +1 -0
  72. package/Libraries/Renderer/shims/ReactNativeTypes.js +21 -25
  73. package/Libraries/Renderer/shims/ReactNativeTypes.win32.js +270 -0
  74. package/Libraries/StyleSheet/StyleSheetExports.js.flow +3 -1
  75. package/Libraries/StyleSheet/StyleSheetTypes.js +4 -3
  76. package/Libraries/StyleSheet/private/_TransformStyle.js +49 -21
  77. package/Libraries/StyleSheet/processBoxShadow.js +0 -1
  78. package/Libraries/StyleSheet/processFilter.js +0 -1
  79. package/Libraries/Text/Text.d.ts +7 -0
  80. package/Libraries/Text/Text.js +255 -244
  81. package/Libraries/Text/Text.win32.js +293 -284
  82. package/Libraries/Text/TextAncestor.js +3 -2
  83. package/Libraries/Text/TextProps.js +2 -34
  84. package/Libraries/Text/TextProps.win32.js +2 -33
  85. package/Libraries/Types/ReactDevToolsTypes.js +0 -1
  86. package/Libraries/Utilities/PerformanceLoggerContext.js +2 -2
  87. package/Libraries/Utilities/PlatformTypes.js +1 -1
  88. package/Libraries/vendor/core/ErrorUtils.js +28 -4
  89. package/index.js +0 -1
  90. package/jest/mockNativeComponent.js +2 -1
  91. package/jest/renderer.js +0 -1
  92. package/jest/resolver.js +31 -0
  93. package/jest/setup.js +1 -1
  94. package/overrides.json +27 -20
  95. package/package.json +13 -13
  96. package/src/private/animated/NativeAnimatedHelper.js +6 -1
  97. package/src/private/animated/NativeAnimatedHelper.win32.js +6 -1
  98. package/src/private/animated/createAnimatedPropsHook.js +11 -4
  99. package/src/private/animated/createAnimatedPropsMemoHook.js +0 -1
  100. package/src/private/components/safeareaview/SafeAreaView_INTERNAL_DO_NOT_USE.js +0 -1
  101. package/src/private/components/scrollview/HScrollViewNativeComponents.js +0 -1
  102. package/src/private/components/scrollview/VScrollViewNativeComponents.js +0 -1
  103. package/src/private/devsupport/rndevtools/FuseboxSessionObserver.js +0 -1
  104. package/src/private/devsupport/rndevtools/ReactDevToolsSettingsManager.android.js +8 -9
  105. package/src/private/devsupport/rndevtools/ReactDevToolsSettingsManager.ios.js +12 -15
  106. package/src/private/devsupport/rndevtools/ReactDevToolsSettingsManager.win32.js +8 -9
  107. package/src/private/devsupport/rndevtools/setUpFuseboxReactDevToolsDispatcher.js +0 -1
  108. package/src/private/devsupport/rndevtools/specs/NativeReactDevToolsRuntimeSettingsModule.js +0 -1
  109. package/src/private/featureflags/ReactNativeFeatureFlags.js +39 -4
  110. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +5 -2
  111. package/src/private/setup/setUpDefaultReactNativeEnvironment.js +44 -0
  112. package/src/private/styles/composeStyles.js +12 -5
  113. package/src/private/webapis/dom/events/Event.js +3 -0
  114. package/src/private/webapis/dom/events/EventTarget.js +3 -0
  115. package/src/private/webapis/dom/nodes/ReactNativeElement.js +6 -23
  116. package/src/private/webapis/dom/nodes/ReadOnlyNode.js +3 -1
  117. package/src/private/webapis/dom/nodes/specs/NativeDOM.js +38 -0
  118. package/src/private/webapis/dom/oldstylecollections/HTMLCollection.js +3 -0
  119. package/src/private/webapis/dom/oldstylecollections/NodeList.js +3 -0
  120. package/src/private/webapis/errors/DOMException.js +166 -0
  121. package/src/private/webapis/geometry/DOMRect.js +5 -0
  122. package/src/private/webapis/geometry/DOMRectList.js +3 -0
  123. package/src/private/webapis/geometry/DOMRectReadOnly.js +6 -0
  124. package/src/private/webapis/intersectionobserver/IntersectionObserver.js +15 -7
  125. package/src/private/webapis/intersectionobserver/IntersectionObserverEntry.js +3 -0
  126. package/src/private/webapis/intersectionobserver/internals/IntersectionObserverManager.js +80 -18
  127. package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +12 -0
  128. package/src/private/webapis/mutationobserver/MutationObserver.js +23 -33
  129. package/src/private/webapis/mutationobserver/MutationRecord.js +3 -0
  130. package/src/private/webapis/mutationobserver/internals/MutationObserverManager.js +56 -24
  131. package/src/private/webapis/mutationobserver/specs/NativeMutationObserver.js +4 -1
  132. package/src/private/webapis/performance/MemoryInfo.js +4 -1
  133. package/src/private/webapis/performance/Performance.js +19 -8
  134. package/src/private/webapis/performance/PerformanceEntry.js +4 -0
  135. package/src/private/webapis/performance/ReactNativeStartupTiming.js +4 -1
  136. package/src/private/webapis/performance/internals/RawPerformanceEntry.js +2 -0
  137. package/src/private/webapis/structuredClone/structuredClone.js +233 -0
  138. package/src/private/webapis/webidl/PlatformObjects.js +59 -0
  139. package/src/types/globals.d.ts +42 -0
  140. package/src-win/Libraries/Text/Text.d.ts +7 -0
  141. package/types/index.d.ts +1 -1
@@ -6,7 +6,6 @@
6
6
  *
7
7
  * @flow strict
8
8
  * @format
9
- * @oncall react_native
10
9
  */
11
10
 
12
11
  class FuseboxSessionObserver {
@@ -4,17 +4,16 @@
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
- * @flow strict-local
7
+ * @flow strict
8
8
  * @format
9
9
  */
10
10
 
11
11
  import NativeReactDevToolsSettingsManager from './specs/NativeReactDevToolsSettingsManager';
12
12
 
13
- module.exports = {
14
- setGlobalHookSettings(settings: string) {
15
- NativeReactDevToolsSettingsManager?.setGlobalHookSettings(settings);
16
- },
17
- getGlobalHookSettings(): ?string {
18
- return NativeReactDevToolsSettingsManager?.getGlobalHookSettings();
19
- },
20
- };
13
+ export function setGlobalHookSettings(settings: string) {
14
+ NativeReactDevToolsSettingsManager?.setGlobalHookSettings(settings);
15
+ }
16
+
17
+ export function getGlobalHookSettings(): ?string {
18
+ return NativeReactDevToolsSettingsManager?.getGlobalHookSettings();
19
+ }
@@ -12,19 +12,16 @@ import Settings from '../../../../Libraries/Settings/Settings';
12
12
 
13
13
  const GLOBAL_HOOK_SETTINGS = 'ReactDevTools::HookSettings';
14
14
 
15
- const ReactDevToolsSettingsManager = {
16
- setGlobalHookSettings(settings: string): void {
17
- Settings.set({
18
- [GLOBAL_HOOK_SETTINGS]: settings,
19
- });
20
- },
21
- getGlobalHookSettings(): ?string {
22
- const value = Settings.get(GLOBAL_HOOK_SETTINGS);
23
- if (typeof value === 'string') {
24
- return value;
25
- }
26
- return null;
27
- },
28
- };
15
+ export function setGlobalHookSettings(settings: string) {
16
+ Settings.set({
17
+ [GLOBAL_HOOK_SETTINGS]: settings,
18
+ });
19
+ }
29
20
 
30
- module.exports = ReactDevToolsSettingsManager;
21
+ export function getGlobalHookSettings(): ?string {
22
+ const value = Settings.get(GLOBAL_HOOK_SETTINGS);
23
+ if (typeof value === 'string') {
24
+ return value;
25
+ }
26
+ return null;
27
+ }
@@ -4,17 +4,16 @@
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
- * @flow strict-local
7
+ * @flow strict
8
8
  * @format
9
9
  */
10
10
 
11
11
  import NativeReactDevToolsSettingsManager from './specs/NativeReactDevToolsSettingsManager';
12
12
 
13
- module.exports = {
14
- setGlobalHookSettings(settings: string) {
15
- NativeReactDevToolsSettingsManager?.setGlobalHookSettings(settings);
16
- },
17
- getGlobalHookSettings(): ?string {
18
- return NativeReactDevToolsSettingsManager?.getGlobalHookSettings();
19
- },
20
- };
13
+ export function setGlobalHookSettings(settings: string) {
14
+ NativeReactDevToolsSettingsManager?.setGlobalHookSettings(settings);
15
+ }
16
+
17
+ export function getGlobalHookSettings(): ?string {
18
+ return NativeReactDevToolsSettingsManager?.getGlobalHookSettings();
19
+ }
@@ -6,7 +6,6 @@
6
6
  *
7
7
  * @flow strict-local
8
8
  * @format
9
- * @oncall react_native
10
9
  */
11
10
 
12
11
  type JSONValue =
@@ -6,7 +6,6 @@
6
6
  *
7
7
  * @flow strict-local
8
8
  * @format
9
- * @oncall react_native
10
9
  */
11
10
 
12
11
  import type {TurboModule} from '../../../../../Libraries/TurboModule/RCTExport';
@@ -4,8 +4,9 @@
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<<6667fc8e4fdd2db0b54c908155b110cf>>
7
+ * @generated SignedSource<<81be36e22e6ec5f6720c89089d725086>>
8
8
  * @flow strict
9
+ * @noformat
9
10
  */
10
11
 
11
12
  /**
@@ -33,12 +34,16 @@ export type ReactNativeFeatureFlagsJsOnly = $ReadOnly<{
33
34
  avoidStateUpdateInAnimatedPropsMemo: Getter<boolean>,
34
35
  disableInteractionManager: Getter<boolean>,
35
36
  enableAccessToHostTreeInFabric: Getter<boolean>,
37
+ enableVirtualViewDebugFeatures: Getter<boolean>,
38
+ enableVirtualViewDoubleStateHidden: Getter<boolean>,
36
39
  fixVirtualizeListCollapseWindowSize: Getter<boolean>,
37
40
  isLayoutAnimationEnabled: Getter<boolean>,
41
+ reduceDefaultPropsInView: Getter<boolean>,
38
42
  scheduleAnimatedCleanupInMicrotask: Getter<boolean>,
39
43
  shouldUseAnimatedObjectForTransform: Getter<boolean>,
40
44
  shouldUseRemoveClippedSubviewsAsDefaultOnIOS: Getter<boolean>,
41
45
  shouldUseSetNativePropsInFabric: Getter<boolean>,
46
+ utilizeTokensInIntersectionObserver: Getter<boolean>,
42
47
  }>;
43
48
 
44
49
  export type ReactNativeFeatureFlagsJsOnlyOverrides = OverridesFor<ReactNativeFeatureFlagsJsOnly>;
@@ -48,6 +53,7 @@ export type ReactNativeFeatureFlags = $ReadOnly<{
48
53
  commonTestFlag: Getter<boolean>,
49
54
  commonTestFlagWithoutNativeImplementation: Getter<boolean>,
50
55
  animatedShouldSignalBatch: Getter<boolean>,
56
+ avoidCeilingAvailableAndroidTextWidth: Getter<boolean>,
51
57
  cxxNativeAnimatedEnabled: Getter<boolean>,
52
58
  disableMainQueueSyncDispatchIOS: Getter<boolean>,
53
59
  disableMountItemReorderingAndroid: Getter<boolean>,
@@ -64,7 +70,7 @@ export type ReactNativeFeatureFlags = $ReadOnly<{
64
70
  enableFixForParentTagDuringReparenting: Getter<boolean>,
65
71
  enableFontScaleChangesUpdatingLayout: Getter<boolean>,
66
72
  enableIOSViewClipToPaddingBox: Getter<boolean>,
67
- enableJSRuntimeGCOnMemoryPressureOnIOS: Getter<boolean>,
73
+ enableIntersectionObserverEventLoopIntegration: Getter<boolean>,
68
74
  enableLayoutAnimationsOnAndroid: Getter<boolean>,
69
75
  enableLayoutAnimationsOnIOS: Getter<boolean>,
70
76
  enableMainQueueModulesOnIOS: Getter<boolean>,
@@ -86,6 +92,7 @@ export type ReactNativeFeatureFlags = $ReadOnly<{
86
92
  traceTurboModulePromiseRejectionsOnAndroid: Getter<boolean>,
87
93
  updateRuntimeShadowNodeReferencesOnCommit: Getter<boolean>,
88
94
  useAlwaysAvailableJSErrorHandling: Getter<boolean>,
95
+ useAndroidTextLayoutWidthDirectly: Getter<boolean>,
89
96
  useFabricInterop: Getter<boolean>,
90
97
  useNativeViewConfigsInBridgelessMode: Getter<boolean>,
91
98
  useOptimizedEventBatchingOnAndroid: Getter<boolean>,
@@ -125,6 +132,16 @@ export const disableInteractionManager: Getter<boolean> = createJavaScriptFlagGe
125
132
  */
126
133
  export const enableAccessToHostTreeInFabric: Getter<boolean> = createJavaScriptFlagGetter('enableAccessToHostTreeInFabric', false);
127
134
 
135
+ /**
136
+ * Enables VirtualView debug features such as logging and overlays.
137
+ */
138
+ export const enableVirtualViewDebugFeatures: Getter<boolean> = createJavaScriptFlagGetter('enableVirtualViewDebugFeatures', false);
139
+
140
+ /**
141
+ * Enables a VirtualView workaround that triggers a second state update when changing to hidden mode.
142
+ */
143
+ export const enableVirtualViewDoubleStateHidden: Getter<boolean> = createJavaScriptFlagGetter('enableVirtualViewDoubleStateHidden', false);
144
+
128
145
  /**
129
146
  * 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
130
147
  */
@@ -135,6 +152,11 @@ export const fixVirtualizeListCollapseWindowSize: Getter<boolean> = createJavaSc
135
152
  */
136
153
  export const isLayoutAnimationEnabled: Getter<boolean> = createJavaScriptFlagGetter('isLayoutAnimationEnabled', true);
137
154
 
155
+ /**
156
+ * Optimize how default (accessibility) props are processed in View to avoid unnecessary keys.
157
+ */
158
+ export const reduceDefaultPropsInView: Getter<boolean> = createJavaScriptFlagGetter('reduceDefaultPropsInView', true);
159
+
138
160
  /**
139
161
  * Changes the cleanup of `AnimatedProps` to occur in a microtask instead of synchronously during effect cleanup (for unmount) or subsequent mounts (for updates).
140
162
  */
@@ -155,6 +177,11 @@ export const shouldUseRemoveClippedSubviewsAsDefaultOnIOS: Getter<boolean> = cre
155
177
  */
156
178
  export const shouldUseSetNativePropsInFabric: Getter<boolean> = createJavaScriptFlagGetter('shouldUseSetNativePropsInFabric', true);
157
179
 
180
+ /**
181
+ * Use tokens in IntersectionObserver vs ShadowNode.
182
+ */
183
+ export const utilizeTokensInIntersectionObserver: Getter<boolean> = createJavaScriptFlagGetter('utilizeTokensInIntersectionObserver', true);
184
+
158
185
  /**
159
186
  * Common flag for testing. Do NOT modify.
160
187
  */
@@ -167,6 +194,10 @@ export const commonTestFlagWithoutNativeImplementation: Getter<boolean> = create
167
194
  * Enables start- and finishOperationBatch on any platform.
168
195
  */
169
196
  export const animatedShouldSignalBatch: Getter<boolean> = createNativeFlagGetter('animatedShouldSignalBatch', false);
197
+ /**
198
+ * Do not incorrectly ceil the available width of an Android text layout
199
+ */
200
+ export const avoidCeilingAvailableAndroidTextWidth: Getter<boolean> = createNativeFlagGetter('avoidCeilingAvailableAndroidTextWidth', true);
170
201
  /**
171
202
  * Use a C++ implementation of Native Animated instead of the platform implementation.
172
203
  */
@@ -232,9 +263,9 @@ export const enableFontScaleChangesUpdatingLayout: Getter<boolean> = createNativ
232
263
  */
233
264
  export const enableIOSViewClipToPaddingBox: Getter<boolean> = createNativeFlagGetter('enableIOSViewClipToPaddingBox', false);
234
265
  /**
235
- * Trigger JS runtime GC on memory pressure event on iOS
266
+ * Integrates IntersectionObserver in the Event Loop in the new architecture, to dispatch the initial notifications for observations in the "Update the rendering" step.
236
267
  */
237
- export const enableJSRuntimeGCOnMemoryPressureOnIOS: Getter<boolean> = createNativeFlagGetter('enableJSRuntimeGCOnMemoryPressureOnIOS', false);
268
+ export const enableIntersectionObserverEventLoopIntegration: Getter<boolean> = createNativeFlagGetter('enableIntersectionObserverEventLoopIntegration', true);
238
269
  /**
239
270
  * When enabled, LayoutAnimations API will animate state changes on Android.
240
271
  */
@@ -319,6 +350,10 @@ export const updateRuntimeShadowNodeReferencesOnCommit: Getter<boolean> = create
319
350
  * In Bridgeless mode, use the always available javascript error reporting pipeline.
320
351
  */
321
352
  export const useAlwaysAvailableJSErrorHandling: Getter<boolean> = createNativeFlagGetter('useAlwaysAvailableJSErrorHandling', false);
353
+ /**
354
+ * Trust the width of a text layout we create, instead of re-deriving it from its contents
355
+ */
356
+ export const useAndroidTextLayoutWidthDirectly: Getter<boolean> = createNativeFlagGetter('useAndroidTextLayoutWidthDirectly', true);
322
357
  /**
323
358
  * 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.
324
359
  */
@@ -4,8 +4,9 @@
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<<4bf477efaec82ad8e9e4b1bc17705fd2>>
7
+ * @generated SignedSource<<ddb43daeb855838f8d396dfa952e9933>>
8
8
  * @flow strict
9
+ * @noformat
9
10
  */
10
11
 
11
12
  /**
@@ -26,6 +27,7 @@ export interface Spec extends TurboModule {
26
27
  +commonTestFlag?: () => boolean;
27
28
  +commonTestFlagWithoutNativeImplementation?: () => boolean;
28
29
  +animatedShouldSignalBatch?: () => boolean;
30
+ +avoidCeilingAvailableAndroidTextWidth?: () => boolean;
29
31
  +cxxNativeAnimatedEnabled?: () => boolean;
30
32
  +disableMainQueueSyncDispatchIOS?: () => boolean;
31
33
  +disableMountItemReorderingAndroid?: () => boolean;
@@ -42,7 +44,7 @@ export interface Spec extends TurboModule {
42
44
  +enableFixForParentTagDuringReparenting?: () => boolean;
43
45
  +enableFontScaleChangesUpdatingLayout?: () => boolean;
44
46
  +enableIOSViewClipToPaddingBox?: () => boolean;
45
- +enableJSRuntimeGCOnMemoryPressureOnIOS?: () => boolean;
47
+ +enableIntersectionObserverEventLoopIntegration?: () => boolean;
46
48
  +enableLayoutAnimationsOnAndroid?: () => boolean;
47
49
  +enableLayoutAnimationsOnIOS?: () => boolean;
48
50
  +enableMainQueueModulesOnIOS?: () => boolean;
@@ -64,6 +66,7 @@ export interface Spec extends TurboModule {
64
66
  +traceTurboModulePromiseRejectionsOnAndroid?: () => boolean;
65
67
  +updateRuntimeShadowNodeReferencesOnCommit?: () => boolean;
66
68
  +useAlwaysAvailableJSErrorHandling?: () => boolean;
69
+ +useAndroidTextLayoutWidthDirectly?: () => boolean;
67
70
  +useFabricInterop?: () => boolean;
68
71
  +useNativeViewConfigsInBridgelessMode?: () => boolean;
69
72
  +useOptimizedEventBatchingOnAndroid?: () => boolean;
@@ -0,0 +1,44 @@
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
+ let initialized = false;
12
+
13
+ export default function setUpDefaltReactNativeEnvironment(
14
+ enableDeveloperTools: boolean = true,
15
+ ) {
16
+ if (initialized) {
17
+ return;
18
+ }
19
+
20
+ initialized = true;
21
+
22
+ require('../../../Libraries/Core/setUpGlobals');
23
+ require('./setUpDOM').default();
24
+ require('../../../Libraries/Core/setUpPerformance');
25
+ require('../../../Libraries/Core/polyfillPromise');
26
+ require('../../../Libraries/Core/setUpTimers');
27
+ if (__DEV__ && enableDeveloperTools) {
28
+ require('../../../Libraries/Core/setUpReactDevTools');
29
+ }
30
+ require('../../../Libraries/Core/setUpErrorHandling');
31
+ require('../../../Libraries/Core/setUpRegeneratorRuntime');
32
+ require('../../../Libraries/Core/setUpXHR');
33
+ require('../../../Libraries/Core/setUpAlert');
34
+ require('../../../Libraries/Core/setUpNavigator');
35
+ require('../../../Libraries/Core/setUpBatchedBridge');
36
+ require('../../../Libraries/Core/setUpSegmentFetcher');
37
+ if (__DEV__ && enableDeveloperTools) {
38
+ require('../../../Libraries/Core/checkNativeVersion');
39
+ require('../../../Libraries/Core/setUpDeveloperTools');
40
+ require('../../../Libraries/LogBox/LogBox').default.install();
41
+ }
42
+
43
+ require('../../../Libraries/ReactNative/AppRegistry');
44
+ }
@@ -4,19 +4,26 @@
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
- * @flow strict
8
7
  * @format
9
8
  */
10
9
 
10
+ import type {
11
+ ImageStyle,
12
+ TextStyle,
13
+ ViewStyle,
14
+ } from '../../../Libraries/StyleSheet/StyleSheet';
15
+ import type {StyleProp} from '../../../Libraries/StyleSheet/StyleSheetTypes';
16
+
11
17
  /**
12
18
  * Combines two styles such that `style2` will override any styles in `style1`.
13
19
  * If either style is null or undefined, the other one is returned without
14
20
  * allocating an array, saving allocations and enabling memoization.
15
21
  */
16
- export default function composeStyles<T1, T2>(
17
- style1: ?T1,
18
- style2: ?T2,
19
- ): ?(T1 | T2 | $ReadOnlyArray<T1 | T2>) {
22
+ export default function composeStyles<
23
+ T: ViewStyle | ImageStyle | TextStyle,
24
+ U: T,
25
+ V: T,
26
+ >(style1: ?StyleProp<U>, style2: ?StyleProp<V>): ?StyleProp<T> {
20
27
  if (style1 == null) {
21
28
  return style2;
22
29
  }
@@ -17,6 +17,7 @@
17
17
 
18
18
  import type EventTarget from './EventTarget';
19
19
 
20
+ import {setPlatformObject} from '../../webidl/PlatformObjects';
20
21
  import {
21
22
  COMPOSED_PATH_KEY,
22
23
  CURRENT_TARGET_KEY,
@@ -234,3 +235,5 @@ export type EventPhase =
234
235
  | (typeof Event)['CAPTURING_PHASE']
235
236
  | (typeof Event)['AT_TARGET']
236
237
  | (typeof Event)['BUBBLING_PHASE'];
238
+
239
+ setPlatformObject(Event);
@@ -15,6 +15,7 @@
15
15
 
16
16
  import type {EventPhase} from './Event';
17
17
 
18
+ import {setPlatformObject} from '../../webidl/PlatformObjects';
18
19
  import Event from './Event';
19
20
  import {
20
21
  getStopImmediatePropagationFlag,
@@ -229,6 +230,8 @@ export default class EventTarget {
229
230
  }
230
231
  }
231
232
 
233
+ setPlatformObject(EventTarget);
234
+
232
235
  function validateCallback(callback: EventListener, methodName: string): void {
233
236
  if (typeof callback !== 'function' && typeof callback !== 'object') {
234
237
  throw new TypeError(
@@ -12,7 +12,6 @@
12
12
 
13
13
  import type {
14
14
  InternalInstanceHandle,
15
- Node as ShadowNode,
16
15
  ViewConfig,
17
16
  } from '../../../../../Libraries/Renderer/shims/ReactNativeTypes';
18
17
  import type {
@@ -26,7 +25,6 @@ import type {InstanceHandle} from './internals/NodeInternals';
26
25
  import type ReactNativeDocument from './ReactNativeDocument';
27
26
 
28
27
  import TextInputState from '../../../../../Libraries/Components/TextInput/TextInputState';
29
- import {getFabricUIManager} from '../../../../../Libraries/ReactNative/FabricUIManager';
30
28
  import {create as createAttributePayload} from '../../../../../Libraries/ReactNative/ReactFabricPublicInstance/ReactNativeAttributePayload';
31
29
  import warnForStyleProps from '../../../../../Libraries/ReactNative/ReactFabricPublicInstance/warnForStyleProps';
32
30
  import {
@@ -37,7 +35,6 @@ import {
37
35
  } from './internals/NodeInternals';
38
36
  import ReadOnlyElement, {getBoundingClientRect} from './ReadOnlyElement';
39
37
  import NativeDOM from './specs/NativeDOM';
40
- import nullthrows from 'nullthrows';
41
38
 
42
39
  const noop = () => {};
43
40
 
@@ -153,18 +150,14 @@ class ReactNativeElement extends ReadOnlyElement implements NativeMethods {
153
150
  measure(callback: MeasureOnSuccessCallback) {
154
151
  const node = getNativeElementReference(this);
155
152
  if (node != null) {
156
- // $FlowExpectedError[incompatible-type] This is an element instance so the native node reference is always a shadow node.
157
- const shadowNode: ShadowNode = node;
158
- nullthrows(getFabricUIManager()).measure(shadowNode, callback);
153
+ NativeDOM.measure(node, callback);
159
154
  }
160
155
  }
161
156
 
162
157
  measureInWindow(callback: MeasureInWindowOnSuccessCallback) {
163
158
  const node = getNativeElementReference(this);
164
159
  if (node != null) {
165
- // $FlowExpectedError[incompatible-type] This is an element instance so the native node reference is always a shadow node.
166
- const shadowNode: ShadowNode = node;
167
- nullthrows(getFabricUIManager()).measureInWindow(shadowNode, callback);
160
+ NativeDOM.measureInWindow(node, callback);
168
161
  }
169
162
  }
170
163
 
@@ -187,14 +180,9 @@ class ReactNativeElement extends ReadOnlyElement implements NativeMethods {
187
180
  const fromStateNode = getNativeElementReference(relativeToNativeNode);
188
181
 
189
182
  if (toStateNode != null && fromStateNode != null) {
190
- // $FlowExpectedError[incompatible-type] This is an element instance so the native node reference is always a shadow node.
191
- const toStateShadowNode: ShadowNode = toStateNode;
192
- // $FlowExpectedError[incompatible-type] This is an element instance so the native node reference is always a shadow node.
193
- const fromStateShadowNode: ShadowNode = fromStateNode;
194
-
195
- nullthrows(getFabricUIManager()).measureLayout(
196
- toStateShadowNode,
197
- fromStateShadowNode,
183
+ NativeDOM.measureLayout(
184
+ toStateNode,
185
+ fromStateNode,
198
186
  onFail != null ? onFail : noop,
199
187
  onSuccess != null ? onSuccess : noop,
200
188
  );
@@ -214,12 +202,7 @@ class ReactNativeElement extends ReadOnlyElement implements NativeMethods {
214
202
  const node = getNativeElementReference(this);
215
203
 
216
204
  if (node != null && updatePayload != null) {
217
- // $FlowExpectedError[incompatible-type] This is an element instance so the native node reference is always a shadow node.
218
- const shadowNode: ShadowNode = node;
219
- nullthrows(getFabricUIManager()).setNativeProps(
220
- shadowNode,
221
- updatePayload,
222
- );
205
+ NativeDOM.setNativeProps(node, updatePayload);
223
206
  }
224
207
  }
225
208
  }
@@ -15,7 +15,7 @@ import type {InstanceHandle} from './internals/NodeInternals';
15
15
  import type ReactNativeDocument from './ReactNativeDocument';
16
16
  import type ReadOnlyElement from './ReadOnlyElement';
17
17
 
18
- import * as ReactNativeFeatureFlags from '../../../featureflags/ReactNativeFeatureFlags';
18
+ import {setPlatformObject} from '../../webidl/PlatformObjects';
19
19
  import {createNodeList} from '../oldstylecollections/NodeList';
20
20
  import {
21
21
  getNativeNodeReference,
@@ -288,6 +288,8 @@ export default class ReadOnlyNode {
288
288
  static DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number = 32;
289
289
  }
290
290
 
291
+ setPlatformObject(ReadOnlyNode);
292
+
291
293
  export function getChildNodes(
292
294
  node: ReadOnlyNode,
293
295
  ): $ReadOnlyArray<ReadOnlyNode> {
@@ -13,6 +13,7 @@ import type {Node as ShadowNode} from '../../../../../../Libraries/Renderer/shim
13
13
  import type {TurboModule} from '../../../../../../Libraries/TurboModule/RCTExport';
14
14
  import type {InstanceHandle} from '../internals/NodeInternals';
15
15
 
16
+ import {getFabricUIManager} from '../../../../../../Libraries/ReactNative/FabricUIManager';
16
17
  import * as TurboModuleRegistry from '../../../../../../Libraries/TurboModule/TurboModuleRegistry';
17
18
  import nullthrows from 'nullthrows';
18
19
 
@@ -154,10 +155,23 @@ export interface Spec extends TurboModule {
154
155
  onFail: () => void,
155
156
  onSuccess: MeasureLayoutOnSuccessCallback,
156
157
  ) => void;
158
+
159
+ /**
160
+ * Legacy direct manipulation APIs (for `ReactNativeElement`).
161
+ */
162
+
163
+ +setNativeProps?: (
164
+ nativeElementReference: mixed,
165
+ updatePayload: mixed,
166
+ ) => void;
157
167
  }
158
168
 
159
169
  const RawNativeDOM = (TurboModuleRegistry.get<Spec>('NativeDOMCxx'): ?Spec);
160
170
 
171
+ export function getRawNativeDOMForTests(): ?Spec {
172
+ return RawNativeDOM;
173
+ }
174
+
161
175
  // This is the actual interface of this module, but the native module codegen
162
176
  // isn't expressive enough yet.
163
177
  export interface RefinedSpec {
@@ -408,6 +422,14 @@ export interface RefinedSpec {
408
422
  onFail: () => void,
409
423
  onSuccess: MeasureLayoutOnSuccessCallback,
410
424
  ) => void;
425
+
426
+ /**
427
+ * Legacy direct manipulation APIs
428
+ */
429
+ +setNativeProps: (
430
+ nativeElementReference: NativeElementReference,
431
+ updatePayload: {...},
432
+ ) => void;
411
433
  }
412
434
 
413
435
  const NativeDOM: RefinedSpec = {
@@ -574,6 +596,22 @@ const NativeDOM: RefinedSpec = {
574
596
  onSuccess,
575
597
  );
576
598
  },
599
+
600
+ /**
601
+ * Legacy direct manipulation APIs
602
+ */
603
+ setNativeProps(nativeNodeReference, updatePayload) {
604
+ // TODO: remove when RawNativeDOM.setNativeProps is NOT nullable.
605
+ if (RawNativeDOM?.setNativeProps == null) {
606
+ nullthrows(getFabricUIManager()).setNativeProps(
607
+ nativeNodeReference,
608
+ updatePayload,
609
+ );
610
+ return;
611
+ }
612
+
613
+ return RawNativeDOM.setNativeProps(nativeNodeReference, updatePayload);
614
+ },
577
615
  };
578
616
 
579
617
  export default NativeDOM;
@@ -13,6 +13,7 @@
13
13
  import type {ArrayLike} from '../../utils/ArrayLikeUtils';
14
14
 
15
15
  import {createValueIterator} from '../../utils/ArrayLikeUtils';
16
+ import {setPlatformObject} from '../../webidl/PlatformObjects';
16
17
 
17
18
  // IMPORTANT: The type definition for this module is defined in `HTMLCollection.js.flow`
18
19
  // because Flow only supports indexers in classes in declaration files.
@@ -69,6 +70,8 @@ export default class HTMLCollection<T> implements Iterable<T>, ArrayLike<T> {
69
70
  }
70
71
  }
71
72
 
73
+ setPlatformObject(HTMLCollection);
74
+
72
75
  /**
73
76
  * This is an internal method to create instances of `HTMLCollection`,
74
77
  * which avoids leaking its constructor to end users.
@@ -17,6 +17,7 @@ import {
17
17
  createKeyIterator,
18
18
  createValueIterator,
19
19
  } from '../../utils/ArrayLikeUtils';
20
+ import {setPlatformObject} from '../../webidl/PlatformObjects';
20
21
 
21
22
  // IMPORTANT: The Flow type definition for this module is defined in `NodeList.js.flow`
22
23
  // because Flow only supports indexers in classes in declaration files.
@@ -93,6 +94,8 @@ export default class NodeList<T> implements Iterable<T>, ArrayLike<T> {
93
94
  }
94
95
  }
95
96
 
97
+ setPlatformObject(NodeList);
98
+
96
99
  /**
97
100
  * This is an internal method to create instances of `NodeList`,
98
101
  * which avoids leaking its constructor to end users.