@office-iss/react-native-win32 0.0.0-canary.276 → 0.0.0-canary.278

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 (48) hide show
  1. package/.flowconfig +2 -1
  2. package/CHANGELOG.json +31 -1
  3. package/CHANGELOG.md +20 -4
  4. package/Libraries/Animated/NativeAnimatedAllowlist.js +4 -4
  5. package/Libraries/Animated/animations/Animation.js +13 -1
  6. package/Libraries/Animated/animations/DecayAnimation.js +1 -0
  7. package/Libraries/Animated/animations/SpringAnimation.js +1 -0
  8. package/Libraries/Animated/animations/TimingAnimation.js +1 -0
  9. package/Libraries/Animated/nodes/AnimatedAddition.js +8 -2
  10. package/Libraries/Animated/nodes/AnimatedColor.js +4 -1
  11. package/Libraries/Animated/nodes/AnimatedDiffClamp.js +9 -2
  12. package/Libraries/Animated/nodes/AnimatedDivision.js +8 -2
  13. package/Libraries/Animated/nodes/AnimatedInterpolation.js +4 -1
  14. package/Libraries/Animated/nodes/AnimatedModulo.js +4 -2
  15. package/Libraries/Animated/nodes/AnimatedMultiplication.js +8 -2
  16. package/Libraries/Animated/nodes/AnimatedNode.js +25 -0
  17. package/Libraries/Animated/nodes/AnimatedObject.js +8 -2
  18. package/Libraries/Animated/nodes/AnimatedProps.js +13 -2
  19. package/Libraries/Animated/nodes/AnimatedStyle.js +13 -2
  20. package/Libraries/Animated/nodes/AnimatedSubtraction.js +8 -2
  21. package/Libraries/Animated/nodes/AnimatedTracking.js +4 -1
  22. package/Libraries/Animated/nodes/AnimatedTransform.js +4 -1
  23. package/Libraries/Animated/nodes/AnimatedValue.js +4 -1
  24. package/Libraries/Animated/nodes/AnimatedValueXY.js +3 -1
  25. package/Libraries/Core/ReactNativeVersion.js +2 -2
  26. package/Libraries/LayoutAnimation/LayoutAnimation.js +2 -2
  27. package/Libraries/Network/FormData.js +11 -3
  28. package/Libraries/Text/Text.d.ts +6 -1
  29. package/Libraries/Text/TextProps.js +2 -2
  30. package/Libraries/Text/TextProps.win32.js +2 -2
  31. package/overrides.json +4 -4
  32. package/package.json +10 -11
  33. package/src/private/animated/useAnimatedPropsMemo.js +12 -4
  34. package/src/private/featureflags/ReactNativeFeatureFlags.js +18 -7
  35. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +3 -2
  36. package/src/private/webapis/dom/nodes/ReactNativeElement.js +48 -6
  37. package/src/private/webapis/dom/nodes/ReadOnlyNode.js +3 -1
  38. package/src/private/webapis/intersectionobserver/IntersectionObserver.js +11 -11
  39. package/src/private/webapis/intersectionobserver/IntersectionObserverEntry.js +1 -1
  40. package/src/private/webapis/intersectionobserver/IntersectionObserverManager.js +1 -1
  41. package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +1 -0
  42. package/src/private/webapis/performance/Performance.js +0 -12
  43. package/src/private/webapis/performance/specs/NativePerformance.js +0 -11
  44. package/src-win/Libraries/Text/Text.d.ts +6 -1
  45. package/Libraries/ReactNative/__mocks__/FabricUIManager.js +0 -334
  46. package/src/private/webapis/dom/nodes/specs/__mocks__/NativeDOMMock.js +0 -413
  47. package/src/private/webapis/intersectionobserver/specs/__mocks__/NativeIntersectionObserver.js +0 -181
  48. package/src/private/webapis/mutationobserver/specs/__mocks__/NativeMutationObserver.js +0 -327
@@ -13,6 +13,7 @@
13
13
  import type Animation, {EndCallback} from '../animations/Animation';
14
14
  import type {InterpolationConfigType} from './AnimatedInterpolation';
15
15
  import type AnimatedNode from './AnimatedNode';
16
+ import type {AnimatedNodeConfig} from './AnimatedNode';
16
17
  import type AnimatedTracking from './AnimatedTracking';
17
18
 
18
19
  import NativeAnimatedHelper from '../../../src/private/animated/NativeAnimatedHelper';
@@ -21,6 +22,7 @@ import AnimatedInterpolation from './AnimatedInterpolation';
21
22
  import AnimatedWithChildren from './AnimatedWithChildren';
22
23
 
23
24
  export type AnimatedValueConfig = $ReadOnly<{
25
+ ...AnimatedNodeConfig,
24
26
  useNativeDriver: boolean,
25
27
  }>;
26
28
 
@@ -90,7 +92,7 @@ export default class AnimatedValue extends AnimatedWithChildren {
90
92
  _tracking: ?AnimatedTracking;
91
93
 
92
94
  constructor(value: number, config?: ?AnimatedValueConfig) {
93
- super();
95
+ super(config);
94
96
  if (typeof value !== 'number') {
95
97
  throw new Error('AnimatedValue: Attempting to set value to undefined');
96
98
  }
@@ -298,6 +300,7 @@ export default class AnimatedValue extends AnimatedWithChildren {
298
300
  type: 'value',
299
301
  value: this._value,
300
302
  offset: this._offset,
303
+ debugID: this.__getDebugID(),
301
304
  };
302
305
  }
303
306
  }
@@ -11,12 +11,14 @@
11
11
  'use strict';
12
12
 
13
13
  import type {PlatformConfig} from '../AnimatedPlatformConfig';
14
+ import type {AnimatedNodeConfig} from './AnimatedNode';
14
15
 
15
16
  import AnimatedValue from './AnimatedValue';
16
17
  import AnimatedWithChildren from './AnimatedWithChildren';
17
18
  import invariant from 'invariant';
18
19
 
19
20
  export type AnimatedValueXYConfig = $ReadOnly<{
21
+ ...AnimatedNodeConfig,
20
22
  useNativeDriver: boolean,
21
23
  }>;
22
24
  type ValueXYListenerCallback = (value: {x: number, y: number, ...}) => mixed;
@@ -49,7 +51,7 @@ export default class AnimatedValueXY extends AnimatedWithChildren {
49
51
  },
50
52
  config?: ?AnimatedValueXYConfig,
51
53
  ) {
52
- super();
54
+ super(config);
53
55
  const value: any = valueIn || {x: 0, y: 0}; // @flowfixme: shouldn't need `: any`
54
56
  if (typeof value.x === 'number' && typeof value.y === 'number') {
55
57
  this.x = new AnimatedValue(value.x);
@@ -15,9 +15,9 @@ const version: $ReadOnly<{
15
15
  prerelease: string | null,
16
16
  }> = {
17
17
  major: 0,
18
- minor: 77,
18
+ minor: 78,
19
19
  patch: 0,
20
- prerelease: 'nightly-20241125-4cffff35e',
20
+ prerelease: 'nightly-20241210-6d235853f',
21
21
  };
22
22
 
23
23
  module.exports = {version};
@@ -121,7 +121,7 @@ const Presets = {
121
121
  'opacity',
122
122
  ): LayoutAnimationConfig),
123
123
  linear: (create(500, 'linear', 'opacity'): LayoutAnimationConfig),
124
- spring: {
124
+ spring: ({
125
125
  duration: 700,
126
126
  create: {
127
127
  type: 'linear',
@@ -135,7 +135,7 @@ const Presets = {
135
135
  type: 'linear',
136
136
  property: 'opacity',
137
137
  },
138
- },
138
+ }: LayoutAnimationConfig),
139
139
  };
140
140
 
141
141
  /**
@@ -28,6 +28,15 @@ type FormDataPart =
28
28
  ...
29
29
  };
30
30
 
31
+ /**
32
+ * Encode a FormData filename compliant with RFC 2183
33
+ *
34
+ * https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition#directives
35
+ */
36
+ function encodeFilename(filename: string): string {
37
+ return encodeURIComponent(filename.replace(/\//g, '_'));
38
+ }
39
+
31
40
  /**
32
41
  * Polyfill for XMLHttpRequest2 FormData API, allowing multipart POST requests
33
42
  * with mixed data (string, native files) to be submitted via XMLHttpRequest.
@@ -82,9 +91,8 @@ class FormData {
82
91
  // content type (cf. web Blob interface.)
83
92
  if (typeof value === 'object' && !Array.isArray(value) && value) {
84
93
  if (typeof value.name === 'string') {
85
- headers['content-disposition'] += `; filename="${
86
- value.name
87
- }"; filename*=utf-8''${encodeURI(value.name)}`;
94
+ headers['content-disposition'] +=
95
+ `; filename="${encodeFilename(value.name)}"`;
88
96
  }
89
97
  if (typeof value.type === 'string') {
90
98
  headers['content-type'] = value.type;
@@ -12,7 +12,7 @@ import {Constructor} from '../../types/private/Utilities';
12
12
  import {AccessibilityProps} from '../Components/View/ViewAccessibility';
13
13
  import {NativeMethods} from '../../types/public/ReactNativeTypes';
14
14
  import {ColorValue, StyleProp} from '../StyleSheet/StyleSheet';
15
- import {TextStyle} from '../StyleSheet/StyleSheetTypes';
15
+ import {TextStyle, ViewStyle} from '../StyleSheet/StyleSheetTypes';
16
16
  import {
17
17
  GestureResponderEvent,
18
18
  LayoutChangeEvent,
@@ -294,6 +294,11 @@ export interface TextProps
294
294
  * Specifies smallest possible scale a font can reach when adjustsFontSizeToFit is enabled. (values 0.01-1.0).
295
295
  */
296
296
  minimumFontScale?: number | undefined;
297
+
298
+ /**
299
+ * Controls how touch events are handled. Similar to `View`'s `pointerEvents`.
300
+ */
301
+ pointerEvents?: ViewStyle['pointerEvents'] | undefined;
297
302
  }
298
303
 
299
304
  /**
@@ -17,7 +17,7 @@ import type {
17
17
  AccessibilityState,
18
18
  Role,
19
19
  } from '../Components/View/ViewAccessibility';
20
- import type {TextStyleProp} from '../StyleSheet/StyleSheet';
20
+ import type {ColorValue, TextStyleProp} from '../StyleSheet/StyleSheet';
21
21
  import type {
22
22
  LayoutEvent,
23
23
  PointerEvent,
@@ -212,7 +212,7 @@ export type TextProps = $ReadOnly<{
212
212
  *
213
213
  * See https://reactnative.dev/docs/text#selectioncolor
214
214
  */
215
- selectionColor?: ?string,
215
+ selectionColor?: ?ColorValue,
216
216
 
217
217
  dataDetectorType?: ?('phoneNumber' | 'link' | 'email' | 'none' | 'all'),
218
218
 
@@ -17,7 +17,7 @@ import type {
17
17
  AccessibilityState,
18
18
  Role,
19
19
  } from '../Components/View/ViewAccessibility';
20
- import type {TextStyleProp} from '../StyleSheet/StyleSheet';
20
+ import type {ColorValue, TextStyleProp} from '../StyleSheet/StyleSheet';
21
21
  import type {
22
22
  LayoutEvent,
23
23
  PointerEvent,
@@ -225,7 +225,7 @@ export type TextProps = $ReadOnly<{
225
225
  *
226
226
  * See https://reactnative.dev/docs/text#selectioncolor
227
227
  */
228
- selectionColor?: ?string,
228
+ selectionColor?: ?ColorValue,
229
229
 
230
230
  dataDetectorType?: ?('phoneNumber' | 'link' | 'email' | 'none' | 'all'),
231
231
 
package/overrides.json CHANGED
@@ -7,13 +7,13 @@
7
7
  "**/__snapshots__/**",
8
8
  "src-win/rntypes/**"
9
9
  ],
10
- "baseVersion": "0.77.0-nightly-20241125-4cffff35e",
10
+ "baseVersion": "0.78.0-nightly-20241210-6d235853f",
11
11
  "overrides": [
12
12
  {
13
13
  "type": "derived",
14
14
  "file": ".flowconfig",
15
15
  "baseFile": ".flowconfig",
16
- "baseHash": "168a2b4bcf33aba4727eb608902b17b4eb74c95d"
16
+ "baseHash": "38943f268bd48c91a2ace6ad2a9302a3bb346dbd"
17
17
  },
18
18
  {
19
19
  "type": "derived",
@@ -420,7 +420,7 @@
420
420
  "type": "derived",
421
421
  "file": "src-win/Libraries/Text/Text.d.ts",
422
422
  "baseFile": "packages/react-native/Libraries/Text/Text.d.ts",
423
- "baseHash": "4b523469a5c8dcfe53749d1739ccf77c0106375e"
423
+ "baseHash": "21dab7f71254c429d592827ab313f77c18baeda1"
424
424
  },
425
425
  {
426
426
  "type": "derived",
@@ -439,7 +439,7 @@
439
439
  "type": "derived",
440
440
  "file": "src-win/Libraries/Text/TextProps.win32.js",
441
441
  "baseFile": "packages/react-native/Libraries/Text/TextProps.js",
442
- "baseHash": "8e56a028dee989ebb8b06f4c01a1d038f074597d"
442
+ "baseHash": "ef1efdc0fb302273cd98be71aef2986677dda184"
443
443
  },
444
444
  {
445
445
  "type": "patch",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@office-iss/react-native-win32",
3
- "version": "0.0.0-canary.276",
3
+ "version": "0.0.0-canary.278",
4
4
  "description": "Implementation of react native on top of Office's Win32 platform.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -30,13 +30,13 @@
30
30
  "@react-native-community/cli-platform-android": "15.0.0-alpha.2",
31
31
  "@react-native-community/cli-platform-ios": "15.0.0-alpha.2",
32
32
  "@react-native/assets": "1.0.0",
33
- "@react-native/assets-registry": "0.77.0-nightly-20241125-4cffff35e",
34
- "@react-native/codegen": "0.77.0-nightly-20241125-4cffff35e",
35
- "@react-native/community-cli-plugin": "0.77.0-nightly-20241125-4cffff35e",
36
- "@react-native/gradle-plugin": "0.77.0-nightly-20241125-4cffff35e",
37
- "@react-native/js-polyfills": "0.77.0-nightly-20241125-4cffff35e",
38
- "@react-native/normalize-colors": "0.77.0-nightly-20241125-4cffff35e",
39
- "@react-native/virtualized-lists": "0.77.0-nightly-20241125-4cffff35e",
33
+ "@react-native/assets-registry": "0.78.0-nightly-20241210-6d235853f",
34
+ "@react-native/codegen": "0.78.0-nightly-20241210-6d235853f",
35
+ "@react-native/community-cli-plugin": "0.78.0-nightly-20241210-6d235853f",
36
+ "@react-native/gradle-plugin": "0.78.0-nightly-20241210-6d235853f",
37
+ "@react-native/js-polyfills": "0.78.0-nightly-20241210-6d235853f",
38
+ "@react-native/normalize-colors": "0.78.0-nightly-20241210-6d235853f",
39
+ "@react-native/virtualized-lists": "0.78.0-nightly-20241210-6d235853f",
40
40
  "abort-controller": "^3.0.0",
41
41
  "anser": "^1.4.9",
42
42
  "ansi-regex": "^5.0.0",
@@ -51,7 +51,6 @@
51
51
  "glob": "^7.1.1",
52
52
  "invariant": "^2.2.4",
53
53
  "jest-environment-node": "^29.6.3",
54
- "jsc-android": "^250231.0.0",
55
54
  "memoize-one": "^5.0.0",
56
55
  "metro-runtime": "^0.81.0",
57
56
  "metro-source-map": "^0.81.0",
@@ -90,14 +89,14 @@
90
89
  "just-scripts": "^1.3.3",
91
90
  "prettier": "2.8.8",
92
91
  "react": "18.3.1",
93
- "react-native": "0.77.0-nightly-20241125-4cffff35e",
92
+ "react-native": "0.78.0-nightly-20241210-6d235853f",
94
93
  "react-native-platform-override": "^1.9.49",
95
94
  "typescript": "5.0.4"
96
95
  },
97
96
  "peerDependencies": {
98
97
  "@types/react": "^18.2.6",
99
98
  "react": "^18.2.0",
100
- "react-native": "0.77.0-nightly-20241125-4cffff35e"
99
+ "react-native": "0.78.0-nightly-20241210-6d235853f"
101
100
  },
102
101
  "beachball": {
103
102
  "defaultNpmTag": "canary",
@@ -113,7 +113,7 @@ export function createCompositeKeyForProps(
113
113
  const key = keys[ii];
114
114
  const value = props[key];
115
115
 
116
- if (allowlist == null || Object.hasOwn(allowlist, key)) {
116
+ if (allowlist == null || hasOwn(allowlist, key)) {
117
117
  let compositeKeyComponent;
118
118
  if (key === 'style') {
119
119
  // $FlowFixMe[incompatible-call] - `style` is a valid argument.
@@ -205,7 +205,7 @@ function createCompositeKeyForObject(
205
205
  for (let ii = 0, length = keys.length; ii < length; ii++) {
206
206
  const key = keys[ii];
207
207
 
208
- if (allowlist == null || Object.hasOwn(allowlist, key)) {
208
+ if (allowlist == null || hasOwn(allowlist, key)) {
209
209
  const value = object[key];
210
210
 
211
211
  let compositeKeyComponent;
@@ -250,7 +250,7 @@ export function areCompositeKeysEqual(
250
250
  }
251
251
  for (let ii = 0; ii < length; ii++) {
252
252
  const key = keys[ii];
253
- if (!Object.hasOwn(next, key)) {
253
+ if (!hasOwn(next, key)) {
254
254
  return false;
255
255
  }
256
256
  const prevComponent = prev[key];
@@ -336,7 +336,7 @@ function areCompositeKeyComponentsEqual(
336
336
  for (let ii = 0; ii < length; ii++) {
337
337
  const key = keys[ii];
338
338
  if (
339
- !Object.hasOwn(nullthrows(next), key) ||
339
+ !hasOwn(nullthrows(next), key) ||
340
340
  !areCompositeKeyComponentsEqual(prev[key], next[key])
341
341
  ) {
342
342
  return false;
@@ -346,3 +346,11 @@ function areCompositeKeyComponentsEqual(
346
346
  }
347
347
  return false;
348
348
  }
349
+
350
+ // Supported versions of JSC do not implement the newer Object.hasOwn. Remove
351
+ // this shim when they do.
352
+ // $FlowIgnore[method-unbinding]
353
+ const _hasOwnProp = Object.prototype.hasOwnProperty;
354
+ const hasOwn: (obj: $ReadOnly<{...}>, prop: string) => boolean =
355
+ // $FlowIgnore[method-unbinding]
356
+ Object.hasOwn ?? ((obj, prop) => _hasOwnProp.call(obj, prop));
@@ -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<<83b5798ee1c7a28fffbf110e19641d69>>
7
+ * @generated SignedSource<<67e1f8c80caedcbf7b28a089a2744b9a>>
8
8
  * @flow strict
9
9
  */
10
10
 
@@ -36,6 +36,7 @@ export type ReactNativeFeatureFlagsJsOnly = {
36
36
  enableAnimatedAllowlist: Getter<boolean>,
37
37
  enableAnimatedClearImmediateFix: Getter<boolean>,
38
38
  enableAnimatedPropsMemo: Getter<boolean>,
39
+ fixVirtualizeListCollapseWindowSize: Getter<boolean>,
39
40
  isLayoutAnimationEnabled: Getter<boolean>,
40
41
  shouldSkipStateUpdatesForLoopingAnimations: Getter<boolean>,
41
42
  shouldUseAnimatedObjectForTransform: Getter<boolean>,
@@ -63,10 +64,10 @@ export type ReactNativeFeatureFlags = {
63
64
  enableEventEmitterRetentionDuringGesturesOnAndroid: Getter<boolean>,
64
65
  enableFabricLogs: Getter<boolean>,
65
66
  enableFabricRenderer: Getter<boolean>,
66
- enableFabricRendererExclusively: Getter<boolean>,
67
67
  enableFixForViewCommandRace: Getter<boolean>,
68
68
  enableGranularShadowTreeStateReconciliation: Getter<boolean>,
69
69
  enableIOSViewClipToPaddingBox: Getter<boolean>,
70
+ enableImagePrefetchingAndroid: Getter<boolean>,
70
71
  enableLayoutAnimationsOnAndroid: Getter<boolean>,
71
72
  enableLayoutAnimationsOnIOS: Getter<boolean>,
72
73
  enableLongTaskAPI: Getter<boolean>,
@@ -78,6 +79,7 @@ export type ReactNativeFeatureFlags = {
78
79
  enableUIConsistency: Getter<boolean>,
79
80
  enableViewRecycling: Getter<boolean>,
80
81
  excludeYogaFromRawProps: Getter<boolean>,
82
+ fixDifferentiatorEmittingUpdatesWithWrongParentTag: Getter<boolean>,
81
83
  fixMappingOfEventPrioritiesBetweenFabricAndReact: Getter<boolean>,
82
84
  fixMountingCoordinatorReportedPendingTransactionsOnAndroid: Getter<boolean>,
83
85
  fuseboxEnabledDebug: Getter<boolean>,
@@ -142,6 +144,11 @@ export const enableAnimatedClearImmediateFix: Getter<boolean> = createJavaScript
142
144
  */
143
145
  export const enableAnimatedPropsMemo: Getter<boolean> = createJavaScriptFlagGetter('enableAnimatedPropsMemo', true);
144
146
 
147
+ /**
148
+ * 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
149
+ */
150
+ export const fixVirtualizeListCollapseWindowSize: Getter<boolean> = createJavaScriptFlagGetter('fixVirtualizeListCollapseWindowSize', false);
151
+
145
152
  /**
146
153
  * Function used to enable / disabled Layout Animations in React Native.
147
154
  */
@@ -233,10 +240,6 @@ export const enableFabricLogs: Getter<boolean> = createNativeFlagGetter('enableF
233
240
  * Enables the use of the Fabric renderer in the whole app.
234
241
  */
235
242
  export const enableFabricRenderer: Getter<boolean> = createNativeFlagGetter('enableFabricRenderer', false);
236
- /**
237
- * When the app is completely migrated to Fabric, set this flag to true to disable parts of Paper infrastructure that are not needed anymore but consume memory and CPU. Specifically, UIViewOperationQueue and EventDispatcherImpl will no longer work as they will not subscribe to ReactChoreographer for updates.
238
- */
239
- export const enableFabricRendererExclusively: Getter<boolean> = createNativeFlagGetter('enableFabricRendererExclusively', false);
240
243
  /**
241
244
  * Synchronise the view command dispatching with mounting of new transaction
242
245
  */
@@ -249,6 +252,10 @@ export const enableGranularShadowTreeStateReconciliation: Getter<boolean> = crea
249
252
  * iOS Views will clip to their padding box vs border box
250
253
  */
251
254
  export const enableIOSViewClipToPaddingBox: Getter<boolean> = createNativeFlagGetter('enableIOSViewClipToPaddingBox', false);
255
+ /**
256
+ * When enabled, Andoid will build and initiate image prefetch requests on ImageShadowNode::layout
257
+ */
258
+ export const enableImagePrefetchingAndroid: Getter<boolean> = createNativeFlagGetter('enableImagePrefetchingAndroid', false);
252
259
  /**
253
260
  * When enabled, LayoutAnimations API will animate state changes on Android.
254
261
  */
@@ -293,6 +300,10 @@ export const enableViewRecycling: Getter<boolean> = createNativeFlagGetter('enab
293
300
  * When enabled, rawProps in Props will not include Yoga specific props.
294
301
  */
295
302
  export const excludeYogaFromRawProps: Getter<boolean> = createNativeFlagGetter('excludeYogaFromRawProps', false);
303
+ /**
304
+ * Fixes a bug in Differentiator where parent views may be referenced before they're created
305
+ */
306
+ export const fixDifferentiatorEmittingUpdatesWithWrongParentTag: Getter<boolean> = createNativeFlagGetter('fixDifferentiatorEmittingUpdatesWithWrongParentTag', true);
296
307
  /**
297
308
  * Uses the default event priority instead of the discreet event priority by default when dispatching events from Fabric to React.
298
309
  */
@@ -352,7 +363,7 @@ export const useOptimizedEventBatchingOnAndroid: Getter<boolean> = createNativeF
352
363
  /**
353
364
  * When enabled, cloning shadow nodes within react native will update the reference held by the current JS fiber tree.
354
365
  */
355
- export const useRuntimeShadowNodeReferenceUpdate: Getter<boolean> = createNativeFlagGetter('useRuntimeShadowNodeReferenceUpdate', false);
366
+ export const useRuntimeShadowNodeReferenceUpdate: Getter<boolean> = createNativeFlagGetter('useRuntimeShadowNodeReferenceUpdate', true);
356
367
  /**
357
368
  * In Bridgeless mode, should legacy NativeModules use the TurboModule system?
358
369
  */
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @generated SignedSource<<4caaf5dbaa68614ce53c8aecbd512df8>>
7
+ * @generated SignedSource<<fa9dcd18f2e50de520995ce1f26b111e>>
8
8
  * @flow strict
9
9
  */
10
10
 
@@ -37,10 +37,10 @@ export interface Spec extends TurboModule {
37
37
  +enableEventEmitterRetentionDuringGesturesOnAndroid?: () => boolean;
38
38
  +enableFabricLogs?: () => boolean;
39
39
  +enableFabricRenderer?: () => boolean;
40
- +enableFabricRendererExclusively?: () => boolean;
41
40
  +enableFixForViewCommandRace?: () => boolean;
42
41
  +enableGranularShadowTreeStateReconciliation?: () => boolean;
43
42
  +enableIOSViewClipToPaddingBox?: () => boolean;
43
+ +enableImagePrefetchingAndroid?: () => boolean;
44
44
  +enableLayoutAnimationsOnAndroid?: () => boolean;
45
45
  +enableLayoutAnimationsOnIOS?: () => boolean;
46
46
  +enableLongTaskAPI?: () => boolean;
@@ -52,6 +52,7 @@ export interface Spec extends TurboModule {
52
52
  +enableUIConsistency?: () => boolean;
53
53
  +enableViewRecycling?: () => boolean;
54
54
  +excludeYogaFromRawProps?: () => boolean;
55
+ +fixDifferentiatorEmittingUpdatesWithWrongParentTag?: () => boolean;
55
56
  +fixMappingOfEventPrioritiesBetweenFabricAndReact?: () => boolean;
56
57
  +fixMountingCoordinatorReportedPendingTransactionsOnAndroid?: () => boolean;
57
58
  +fuseboxEnabledDebug?: () => boolean;
@@ -25,7 +25,7 @@ import {getFabricUIManager} from '../../../../../Libraries/ReactNative/FabricUIM
25
25
  import {create as createAttributePayload} from '../../../../../Libraries/ReactNative/ReactFabricPublicInstance/ReactNativeAttributePayload';
26
26
  import warnForStyleProps from '../../../../../Libraries/ReactNative/ReactFabricPublicInstance/warnForStyleProps';
27
27
  import ReadOnlyElement, {getBoundingClientRect} from './ReadOnlyElement';
28
- import ReadOnlyNode from './ReadOnlyNode';
28
+ import ReadOnlyNode, {setInstanceHandle} from './ReadOnlyNode';
29
29
  import {
30
30
  getPublicInstanceFromInternalInstanceHandle,
31
31
  getShadowNode,
@@ -35,7 +35,26 @@ import nullthrows from 'nullthrows';
35
35
 
36
36
  const noop = () => {};
37
37
 
38
- export default class ReactNativeElement
38
+ // Ideally, this class would be exported as-is, but this implementation is
39
+ // significantly slower than the existing `ReactFabricHostComponent`.
40
+ // This is a very hot code path (this class is instantiated once per rendered
41
+ // host component in the tree) and we can't regress performance here.
42
+ //
43
+ // This implementation is slower because this is a subclass and we have to call
44
+ // super(), which is a very slow operation the way that Babel transforms it at
45
+ // the moment.
46
+ //
47
+ // The optimization we're doing is using an old-style function constructor,
48
+ // where we're not required to use `super()`, and we make that constructor
49
+ // extend this class so it inherits all the methods and it sets the class
50
+ // hierarchy correctly.
51
+ //
52
+ // An alternative implementation was to implement the constructor as a function
53
+ // returning a manually constructed instance using `Object.create()` but that
54
+ // was slower than this method because the engine has to create an object than
55
+ // we then discard to create a new one.
56
+
57
+ class ReactNativeElementMethods
39
58
  extends ReadOnlyElement
40
59
  implements INativeMethods
41
60
  {
@@ -43,8 +62,10 @@ export default class ReactNativeElement
43
62
  __nativeTag: number;
44
63
  __internalInstanceHandle: InternalInstanceHandle;
45
64
 
46
- #viewConfig: ViewConfig;
65
+ __viewConfig: ViewConfig;
47
66
 
67
+ // This constructor isn't really used. See the `ReactNativeElement` function
68
+ // below.
48
69
  constructor(
49
70
  tag: number,
50
71
  viewConfig: ViewConfig,
@@ -54,7 +75,7 @@ export default class ReactNativeElement
54
75
 
55
76
  this.__nativeTag = tag;
56
77
  this.__internalInstanceHandle = internalInstanceHandle;
57
- this.#viewConfig = viewConfig;
78
+ this.__viewConfig = viewConfig;
58
79
  }
59
80
 
60
81
  get offsetHeight(): number {
@@ -171,12 +192,12 @@ export default class ReactNativeElement
171
192
 
172
193
  setNativeProps(nativeProps: {...}): void {
173
194
  if (__DEV__) {
174
- warnForStyleProps(nativeProps, this.#viewConfig.validAttributes);
195
+ warnForStyleProps(nativeProps, this.__viewConfig.validAttributes);
175
196
  }
176
197
 
177
198
  const updatePayload = createAttributePayload(
178
199
  nativeProps,
179
- this.#viewConfig.validAttributes,
200
+ this.__viewConfig.validAttributes,
180
201
  );
181
202
 
182
203
  const node = getShadowNode(this);
@@ -186,3 +207,24 @@ export default class ReactNativeElement
186
207
  }
187
208
  }
188
209
  }
210
+
211
+ // Alternative constructor just implemented to provide a better performance than
212
+ // calling super() in the original class.
213
+ function ReactNativeElement(
214
+ this: ReactNativeElementMethods,
215
+ tag: number,
216
+ viewConfig: ViewConfig,
217
+ internalInstanceHandle: InternalInstanceHandle,
218
+ ) {
219
+ this.__nativeTag = tag;
220
+ this.__internalInstanceHandle = internalInstanceHandle;
221
+ this.__viewConfig = viewConfig;
222
+ setInstanceHandle(this, internalInstanceHandle);
223
+ }
224
+
225
+ ReactNativeElement.prototype = Object.create(
226
+ ReactNativeElementMethods.prototype,
227
+ );
228
+
229
+ // $FlowExpectedError[prop-missing]
230
+ export default ReactNativeElement as typeof ReactNativeElementMethods;
@@ -26,6 +26,8 @@ let ReadOnlyElementClass: Class<ReadOnlyElement>;
26
26
 
27
27
  export default class ReadOnlyNode {
28
28
  constructor(internalInstanceHandle: InternalInstanceHandle) {
29
+ // This constructor is inlined in `ReactNativeElement` so if you modify
30
+ // this make sure that their implementation stays in sync.
29
31
  setInstanceHandle(this, internalInstanceHandle);
30
32
  }
31
33
 
@@ -293,7 +295,7 @@ export function getInstanceHandle(node: ReadOnlyNode): InternalInstanceHandle {
293
295
  return node[INSTANCE_HANDLE_KEY];
294
296
  }
295
297
 
296
- function setInstanceHandle(
298
+ export function setInstanceHandle(
297
299
  node: ReadOnlyNode,
298
300
  instanceHandle: InternalInstanceHandle,
299
301
  ): void {
@@ -33,10 +33,10 @@ type IntersectionObserverInit = {
33
33
  * If set, it will either be a singular ratio value between 0-1 (inclusive)
34
34
  * or an array of such ratios.
35
35
  *
36
- * Note: If `rn_rootThreshold` is set, and `threshold` is not set,
36
+ * Note: If `rnRootThreshold` is set, and `threshold` is not set,
37
37
  * `threshold` will not default to [0] (as per spec)
38
38
  */
39
- rn_rootThreshold?: number | $ReadOnlyArray<number>,
39
+ rnRootThreshold?: number | $ReadOnlyArray<number>,
40
40
  };
41
41
 
42
42
  /**
@@ -57,7 +57,7 @@ type IntersectionObserverInit = {
57
57
  *
58
58
  * This implementation only supports the `threshold` option at the moment
59
59
  * (`root` and `rootMargin` are not supported) and provides a React Native specific
60
- * option `rn_rootThreshold`.
60
+ * option `rnRootThreshold`.
61
61
  *
62
62
  */
63
63
  export default class IntersectionObserver {
@@ -99,7 +99,7 @@ export default class IntersectionObserver {
99
99
 
100
100
  this._callback = callback;
101
101
 
102
- this._rootThresholds = normalizeRootThreshold(options?.rn_rootThreshold);
102
+ this._rootThresholds = normalizeRootThreshold(options?.rnRootThreshold);
103
103
  this._thresholds = normalizeThreshold(
104
104
  options?.threshold,
105
105
  this._rootThresholds != null, // only provide default if no rootThreshold
@@ -136,9 +136,9 @@ export default class IntersectionObserver {
136
136
  * threshold is a ratio of intersection area to bounding box area of an
137
137
  * observed target.
138
138
  * Notifications for a target are generated when any of the thresholds specified
139
- * in `rn_rootThreshold` or `threshold` are crossed for that target.
139
+ * in `rnRootThreshold` or `threshold` are crossed for that target.
140
140
  *
141
- * If no value was passed to the constructor, and no `rn_rootThreshold`
141
+ * If no value was passed to the constructor, and no `rnRootThreshold`
142
142
  * is set, `0` is used.
143
143
  */
144
144
  get thresholds(): $ReadOnlyArray<number> {
@@ -150,9 +150,9 @@ export default class IntersectionObserver {
150
150
  * threshold is a ratio of intersection area to bounding box area of the specified
151
151
  * root view, which defaults to the viewport.
152
152
  * Notifications for a target are generated when any of the thresholds specified
153
- * in `rn_rootThreshold` or `threshold` are crossed for that target.
153
+ * in `rnRootThreshold` or `threshold` are crossed for that target.
154
154
  */
155
- get rootThresholds(): $ReadOnlyArray<number> | null {
155
+ get rnRootThresholds(): $ReadOnlyArray<number> | null {
156
156
  return this._rootThresholds;
157
157
  }
158
158
 
@@ -293,7 +293,7 @@ function normalizeThreshold(
293
293
  }
294
294
 
295
295
  /**
296
- * Converts the user defined `rn_rootThreshold` value into an array of sorted valid
296
+ * Converts the user defined `rnRootThreshold` value into an array of sorted valid
297
297
  * threshold options for `IntersectionObserver` (double ∈ [0, 1]).
298
298
  *
299
299
  * If invalid array or null, returns null.
@@ -310,13 +310,13 @@ function normalizeRootThreshold(
310
310
  ): null | $ReadOnlyArray<number> {
311
311
  if (Array.isArray(rootThreshold)) {
312
312
  const normalizedArr = rootThreshold
313
- .map(rt => normalizeThresholdValue(rt, 'rn_rootThreshold'))
313
+ .map(rt => normalizeThresholdValue(rt, 'rnRootThreshold'))
314
314
  .filter((rt): rt is number => rt != null)
315
315
  .sort();
316
316
  return normalizedArr.length === 0 ? null : normalizedArr;
317
317
  }
318
318
 
319
- const normalized = normalizeThresholdValue(rootThreshold, 'rn_rootThreshold');
319
+ const normalized = normalizeThresholdValue(rootThreshold, 'rnRootThreshold');
320
320
  return normalized == null ? null : [normalized];
321
321
  }
322
322
 
@@ -77,7 +77,7 @@ export default class IntersectionObserverEntry {
77
77
  /**
78
78
  * Returns the ratio of the `intersectionRect` to the `boundingRootRect`.
79
79
  */
80
- get rn_intersectionRootRatio(): number {
80
+ get rnRootIntersectionRatio(): number {
81
81
  const intersectionRect = this.intersectionRect;
82
82
 
83
83
  const rootRect = this._nativeEntry.rootRect;
@@ -162,7 +162,7 @@ export function observe({
162
162
  intersectionObserverId,
163
163
  targetShadowNode,
164
164
  thresholds: registeredObserver.observer.thresholds,
165
- rootThresholds: registeredObserver.observer.rootThresholds,
165
+ rootThresholds: registeredObserver.observer.rnRootThresholds,
166
166
  });
167
167
 
168
168
  return true;
@@ -17,6 +17,7 @@ export type NativeIntersectionObserverEntry = {
17
17
  targetInstanceHandle: mixed,
18
18
  targetRect: $ReadOnlyArray<number>, // It's actually a tuple with x, y, width and height
19
19
  rootRect: $ReadOnlyArray<number>, // It's actually a tuple with x, y, width and height
20
+ // TODO(T209328432) - Remove optionality of intersectionRect when native changes are released
20
21
  intersectionRect: ?$ReadOnlyArray<number>, // It's actually a tuple with x, y, width and height
21
22
  isIntersectingAboveThresholds: boolean,
22
23
  time: number,