@office-iss/react-native-win32 0.81.2 → 0.82.0-preview.2

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 (209) hide show
  1. package/.flowconfig +3 -11
  2. package/CHANGELOG.json +118 -43
  3. package/CHANGELOG.md +45 -27
  4. package/IntegrationTests/IntegrationTestsApp.js +2 -2
  5. package/IntegrationTests/LayoutEventsTest.js +3 -3
  6. package/Libraries/ActionSheetIOS/ActionSheetIOS.js +7 -3
  7. package/Libraries/Alert/RCTAlertManager.android.js +4 -2
  8. package/Libraries/Animated/Animated.d.ts +2 -0
  9. package/Libraries/Animated/AnimatedEvent.js +1 -1
  10. package/Libraries/Animated/AnimatedExports.js.flow +1 -0
  11. package/Libraries/Animated/AnimatedImplementation.js +4 -2
  12. package/Libraries/Animated/AnimatedMock.js +1 -1
  13. package/Libraries/Animated/Easing.js +2 -0
  14. package/Libraries/Animated/NativeAnimatedAllowlist.js +1 -0
  15. package/Libraries/Animated/animations/Animation.js +19 -20
  16. package/Libraries/Animated/animations/TimingAnimation.js +2 -0
  17. package/Libraries/Animated/components/AnimatedScrollView.js +3 -2
  18. package/Libraries/Animated/components/AnimatedSectionList.js +1 -1
  19. package/Libraries/Animated/nodes/AnimatedColor.js +9 -9
  20. package/Libraries/Animated/nodes/AnimatedInterpolation.js +4 -4
  21. package/Libraries/Animated/nodes/AnimatedNode.js +14 -7
  22. package/Libraries/Animated/nodes/AnimatedObject.js +7 -7
  23. package/Libraries/Animated/nodes/AnimatedProps.js +32 -32
  24. package/Libraries/Animated/nodes/AnimatedStyle.js +23 -21
  25. package/Libraries/Animated/nodes/AnimatedTransform.js +6 -6
  26. package/Libraries/Animated/nodes/AnimatedValue.js +18 -26
  27. package/Libraries/AppState/AppState.js +8 -4
  28. package/Libraries/BatchedBridge/BatchedBridge.js +1 -0
  29. package/Libraries/BatchedBridge/MessageQueue.js +5 -0
  30. package/Libraries/BatchedBridge/NativeModules.js +1 -1
  31. package/Libraries/Blob/BlobManager.js +1 -1
  32. package/Libraries/Blob/URLSearchParams.js +2 -0
  33. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +2 -2
  34. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +2 -2
  35. package/Libraries/Components/Button.js +1 -1
  36. package/Libraries/Components/Button.win32.js +1 -1
  37. package/Libraries/Components/Pressable/Pressable.js +10 -1
  38. package/Libraries/Components/Pressable/Pressable.win32.js +9 -0
  39. package/Libraries/Components/Pressable/useAndroidRippleForView.js +2 -2
  40. package/Libraries/Components/ScrollView/ScrollView.js +13 -4
  41. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +1 -1
  42. package/Libraries/Components/StatusBar/StatusBar.js +2 -2
  43. package/Libraries/Components/Switch/Switch.js +1 -1
  44. package/Libraries/Components/TextInput/TextInput.flow.js +12 -5
  45. package/Libraries/Components/TextInput/TextInput.flow.win32.js +12 -5
  46. package/Libraries/Components/TextInput/TextInput.js +14 -5
  47. package/Libraries/Components/TextInput/TextInput.win32.js +15 -7
  48. package/Libraries/Components/TextInput/TextInputState.js +1 -1
  49. package/Libraries/Components/TextInput/TextInputState.win32.js +1 -1
  50. package/Libraries/Components/TextInput/Win32TextInputNativeComponent.js +2 -3
  51. package/Libraries/Components/Touchable/TouchableBounce.js +1 -1
  52. package/Libraries/Components/Touchable/TouchableHighlight.js +1 -1
  53. package/Libraries/Components/Touchable/TouchableNativeFeedback.js +1 -1
  54. package/Libraries/Components/Touchable/TouchableOpacity.js +1 -1
  55. package/Libraries/Components/Touchable/TouchableWin32.js +1 -1
  56. package/Libraries/Components/Touchable/TouchableWin32.js.map +1 -1
  57. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +3 -3
  58. package/Libraries/Components/View/View.js +81 -167
  59. package/Libraries/Components/View/View.win32.js +3 -1
  60. package/Libraries/Core/Devtools/loadBundleFromServer.js +1 -1
  61. package/Libraries/Core/Devtools/loadBundleFromServer.win32.js +1 -1
  62. package/Libraries/Core/ExceptionsManager.js +4 -2
  63. package/Libraries/Core/ReactFiberErrorDialog.js +3 -3
  64. package/Libraries/Core/ReactNativeVersion.js +37 -10
  65. package/Libraries/Core/Timers/JSTimers.js +4 -1
  66. package/Libraries/Core/Timers/NativeTiming.js +1 -0
  67. package/Libraries/Core/Timers/immediateShim.js +2 -1
  68. package/Libraries/Core/Timers/queueMicrotask.js +1 -0
  69. package/Libraries/Core/setUpPerformance.js +3 -4
  70. package/Libraries/Debugging/DebuggingOverlayRegistry.js +5 -3
  71. package/Libraries/Image/Image.android.js +327 -111
  72. package/Libraries/Image/Image.ios.js +6 -1
  73. package/Libraries/Image/Image.win32.js +6 -1
  74. package/Libraries/Image/ImageSourceUtils.js +8 -2
  75. package/Libraries/Image/assetPaths.js +1 -1
  76. package/Libraries/Image/resolveAssetSource.js +1 -1
  77. package/Libraries/Image/resolveAssetSource.win32.js +6 -7
  78. package/Libraries/Interaction/InteractionManager.js +118 -167
  79. package/Libraries/Interaction/PanResponder.js +7 -52
  80. package/Libraries/LayoutAnimation/LayoutAnimation.js +2 -0
  81. package/Libraries/Lists/FlatList.js +5 -6
  82. package/Libraries/LogBox/Data/LogBoxData.js +5 -2
  83. package/Libraries/LogBox/Data/parseLogBoxLog.js +1 -1
  84. package/Libraries/LogBox/UI/LogBoxInspectorHeader.win32.js +2 -2
  85. package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js +1 -1
  86. package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.win32.js +1 -1
  87. package/Libraries/Modal/Modal.js +3 -3
  88. package/Libraries/NativeComponent/NativeComponentRegistry.js +1 -1
  89. package/Libraries/NativeComponent/ViewConfig.js +2 -2
  90. package/Libraries/Network/RCTNetworking.android.js +1 -1
  91. package/Libraries/Network/RCTNetworking.ios.js +1 -1
  92. package/Libraries/Network/RCTNetworking.win32.js +1 -1
  93. package/Libraries/Network/XMLHttpRequest.js +20 -5
  94. package/Libraries/Network/convertRequestBody.js +1 -1
  95. package/Libraries/PermissionsAndroid/PermissionsAndroid.js +10 -9
  96. package/Libraries/Pressability/HoverState.js +2 -0
  97. package/Libraries/Pressability/HoverState.win32.js +2 -0
  98. package/Libraries/Pressability/Pressability.js +1 -1
  99. package/Libraries/Pressability/Pressability.win32.js +1 -1
  100. package/Libraries/PushNotificationIOS/PushNotificationIOS.js +2 -2
  101. package/Libraries/ReactNative/AppRegistryImpl.js +4 -2
  102. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +2 -0
  103. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +3 -3
  104. package/Libraries/ReactNative/RendererImplementation.js +116 -116
  105. package/Libraries/ReactNative/UIManager.js +3 -3
  106. package/Libraries/ReactNative/renderApplication.js +1 -0
  107. package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +1 -1
  108. package/Libraries/Renderer/implementations/ReactFabric-dev.js +38 -35
  109. package/Libraries/Renderer/implementations/ReactFabric-prod.js +51 -22
  110. package/Libraries/Renderer/implementations/ReactFabric-profiling.js +54 -24
  111. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +36 -33
  112. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +5 -5
  113. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +5 -5
  114. package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +3 -1
  115. package/Libraries/Share/Share.js +4 -0
  116. package/Libraries/StyleSheet/PlatformColorValueTypes.android.js +2 -2
  117. package/Libraries/StyleSheet/PlatformColorValueTypes.ios.js +2 -2
  118. package/Libraries/StyleSheet/PlatformColorValueTypes.win32.js +4 -0
  119. package/Libraries/StyleSheet/StyleSheet.d.ts +7 -22
  120. package/Libraries/StyleSheet/StyleSheetExports.js +2 -8
  121. package/Libraries/StyleSheet/StyleSheetExports.js.flow +11 -18
  122. package/Libraries/StyleSheet/flattenStyle.js +2 -2
  123. package/Libraries/StyleSheet/processAspectRatio.js +2 -0
  124. package/Libraries/StyleSheet/processFilter.js +5 -5
  125. package/Libraries/StyleSheet/splitLayoutProps.js +2 -2
  126. package/Libraries/Text/Text.js +534 -234
  127. package/Libraries/Text/Text.win32.js +647 -274
  128. package/Libraries/Text/TextNativeComponent.js +2 -2
  129. package/Libraries/Text/TextNativeComponent.win32.js +2 -2
  130. package/Libraries/Utilities/Appearance.d.ts +3 -5
  131. package/Libraries/Utilities/Appearance.js +5 -17
  132. package/Libraries/Utilities/HMRClient.js +2 -1
  133. package/Libraries/Utilities/Platform.android.js +3 -3
  134. package/Libraries/Utilities/Platform.d.ts +1 -0
  135. package/Libraries/Utilities/Platform.ios.js +1 -1
  136. package/Libraries/Utilities/Platform.win32.js +3 -3
  137. package/Libraries/Utilities/PlatformTypes.js +1 -1
  138. package/Libraries/Utilities/ReactNativeTestTools.js +12 -0
  139. package/Libraries/Utilities/SceneTracker.js +1 -1
  140. package/Libraries/Utilities/codegenNativeCommands.js +1 -1
  141. package/Libraries/Utilities/codegenNativeComponent.js +1 -1
  142. package/Libraries/Utilities/createPerformanceLogger.js +32 -0
  143. package/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js +2 -0
  144. package/Libraries/Utilities/differ/pointsDiffer.js +1 -1
  145. package/Libraries/Utilities/useMergeRefs.js +1 -1
  146. package/Libraries/WebSocket/WebSocketInterceptor.js +2 -0
  147. package/Libraries/promiseRejectionTrackingOptions.js +17 -31
  148. package/Libraries/vendor/emitter/EventEmitter.js +1 -1
  149. package/flow/bom.js.flow +223 -1
  150. package/flow/prettier.js.flow +14 -0
  151. package/index.js +14 -2
  152. package/index.win32.js +16 -2
  153. package/jest/local-setup.js +2 -2
  154. package/jest/mock.js +1 -1
  155. package/jest/mockComponent.js +9 -9
  156. package/jest/mockNativeComponent.js +3 -2
  157. package/jest/mocks/Modal.js +1 -1
  158. package/jest/mocks/ScrollView.js +1 -1
  159. package/jest/mocks/ViewNativeComponent.js +1 -1
  160. package/jest/setup.js +23 -12
  161. package/overrides.json +23 -23
  162. package/package.json +28 -27
  163. package/saveAssetPlugin.js +2 -2
  164. package/src/private/animated/NativeAnimatedHelper.js +16 -5
  165. package/src/private/animated/NativeAnimatedHelper.win32.js +16 -5
  166. package/src/private/animated/createAnimatedPropsHook.js +11 -60
  167. package/src/private/animated/createAnimatedPropsMemoHook.js +8 -54
  168. package/src/private/components/virtualview/VirtualView.js +43 -12
  169. package/src/private/components/virtualview/VirtualViewExperimentalNativeComponent.js +93 -0
  170. package/src/private/components/virtualview/VirtualViewNativeComponent.js +6 -0
  171. package/src/private/devsupport/devmenu/elementinspector/Inspector.js +2 -2
  172. package/src/private/devsupport/devmenu/elementinspector/ReactDevToolsOverlay.js +2 -2
  173. package/src/private/featureflags/ReactNativeFeatureFlags.js +85 -52
  174. package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +23 -4
  175. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +15 -6
  176. package/src/private/renderer/errorhandling/ErrorHandlers.js +3 -3
  177. package/src/private/setup/{setUpPerformanceObserver.js → setUpPerformanceModern.js} +43 -18
  178. package/src/private/specs_DEPRECATED/modules/NativeTiming.js +1 -0
  179. package/src/private/types/HostInstance.js +4 -1
  180. package/src/private/webapis/dom/nodes/ReactNativeDocument.js +22 -2
  181. package/src/private/webapis/dom/nodes/ReactNativeElement.js +1 -1
  182. package/src/private/webapis/dom/nodes/ReadOnlyElement.js +5 -3
  183. package/src/private/webapis/dom/nodes/ReadOnlyNode.js +16 -13
  184. package/src/private/webapis/dom/nodes/internals/NodeInternals.js +45 -22
  185. package/src/private/webapis/dom/nodes/internals/ReactNativeDocumentInstanceHandle.js +1 -1
  186. package/src/private/webapis/dom/nodes/specs/NativeDOM.js +26 -192
  187. package/src/private/webapis/dom/oldstylecollections/HTMLCollection.js +15 -12
  188. package/src/private/webapis/dom/oldstylecollections/NodeList.js +14 -11
  189. package/src/private/webapis/geometry/DOMRectList.js +2 -2
  190. package/src/private/webapis/intersectionobserver/internals/IntersectionObserverManager.js +19 -74
  191. package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +0 -4
  192. package/src/private/webapis/mutationobserver/internals/MutationObserverManager.js +1 -1
  193. package/src/private/webapis/performance/EventTiming.js +40 -25
  194. package/src/private/webapis/performance/LongTasks.js +35 -2
  195. package/src/private/webapis/performance/Performance.js +347 -166
  196. package/src/private/webapis/performance/PerformanceEntry.js +40 -23
  197. package/src/private/webapis/performance/PerformanceObserver.js +37 -29
  198. package/src/private/webapis/performance/ReactNativeStartupTiming.js +3 -24
  199. package/src/private/webapis/performance/ResourceTiming.js +29 -18
  200. package/src/private/webapis/performance/UserTiming.js +92 -34
  201. package/src/private/webapis/performance/UserTimingExtensibility.js.flow +38 -0
  202. package/src/private/webapis/performance/internals/RawPerformanceEntry.js +3 -4
  203. package/src/private/webapis/performance/internals/Utilities.js +9 -0
  204. package/src/private/webapis/performance/specs/NativePerformance.js +23 -23
  205. package/src/private/webapis/structuredClone/structuredClone.js +10 -10
  206. package/src-win/Libraries/Components/Touchable/TouchableWin32.tsx +1 -1
  207. package/Libraries/Interaction/InteractionManagerStub.js +0 -184
  208. package/Libraries/Interaction/TaskQueue.js +0 -183
  209. package/Libraries/ReactNative/ReactNativeFeatureFlags.js +0 -31
@@ -41,9 +41,9 @@ let startNativeAnimationNextId = 1;
41
41
  // Once an animation has been stopped or finished its course, it will
42
42
  // not be reused.
43
43
  export default class Animation {
44
- #nativeID: ?number;
45
- #onEnd: ?EndCallback;
46
- #useNativeDriver: boolean;
44
+ _nativeID: ?number;
45
+ _onEnd: ?EndCallback;
46
+ _useNativeDriver: boolean;
47
47
 
48
48
  __active: boolean;
49
49
  __isInteraction: boolean;
@@ -52,10 +52,10 @@ export default class Animation {
52
52
  __debugID: ?string;
53
53
 
54
54
  constructor(config: AnimationConfig) {
55
- this.#useNativeDriver = NativeAnimatedHelper.shouldUseNativeDriver(config);
55
+ this._useNativeDriver = NativeAnimatedHelper.shouldUseNativeDriver(config);
56
56
 
57
57
  this.__active = false;
58
- this.__isInteraction = config.isInteraction ?? !this.#useNativeDriver;
58
+ this.__isInteraction = config.isInteraction ?? !this._useNativeDriver;
59
59
  this.__isLooping = config.isLooping;
60
60
  this.__iterations = config.iterations ?? 1;
61
61
  if (__DEV__) {
@@ -70,7 +70,7 @@ export default class Animation {
70
70
  previousAnimation: ?Animation,
71
71
  animatedValue: AnimatedValue,
72
72
  ): void {
73
- if (!this.#useNativeDriver && animatedValue.__isNative === true) {
73
+ if (!this._useNativeDriver && animatedValue.__isNative === true) {
74
74
  throw new Error(
75
75
  'Attempting to run JS driven animation on animated node ' +
76
76
  'that has been moved to "native" earlier by starting an ' +
@@ -78,13 +78,13 @@ export default class Animation {
78
78
  );
79
79
  }
80
80
 
81
- this.#onEnd = onEnd;
81
+ this._onEnd = onEnd;
82
82
  this.__active = true;
83
83
  }
84
84
 
85
85
  stop(): void {
86
- if (this.#nativeID != null) {
87
- const nativeID = this.#nativeID;
86
+ if (this._nativeID != null) {
87
+ const nativeID = this._nativeID;
88
88
  const identifier = `${nativeID}:stopAnimation`;
89
89
  try {
90
90
  // This is only required when singleOpBatching is used, as otherwise
@@ -123,7 +123,7 @@ export default class Animation {
123
123
  }
124
124
 
125
125
  __startAnimationIfNative(animatedValue: AnimatedValue): boolean {
126
- if (!this.#useNativeDriver) {
126
+ if (!this._useNativeDriver) {
127
127
  return false;
128
128
  }
129
129
 
@@ -135,9 +135,9 @@ export default class Animation {
135
135
  try {
136
136
  const config = this.__getNativeAnimationConfig();
137
137
  animatedValue.__makeNative(config.platformConfig);
138
- this.#nativeID = NativeAnimatedHelper.generateNewAnimationId();
138
+ this._nativeID = NativeAnimatedHelper.generateNewAnimationId();
139
139
  NativeAnimatedHelper.API.startAnimatingNode(
140
- this.#nativeID,
140
+ this._nativeID,
141
141
  animatedValue.__getNativeTag(),
142
142
  config,
143
143
  result => {
@@ -150,12 +150,11 @@ export default class Animation {
150
150
  if (value != null) {
151
151
  animatedValue.__onAnimatedValueUpdateReceived(value, offset);
152
152
 
153
- if (
154
- !(
155
- ReactNativeFeatureFlags.cxxNativeAnimatedEnabled() &&
156
- ReactNativeFeatureFlags.cxxNativeAnimatedRemoveJsSync()
157
- )
158
- ) {
153
+ const isJsSyncRemoved =
154
+ ReactNativeFeatureFlags.cxxNativeAnimatedEnabled() &&
155
+ !ReactNativeFeatureFlags.disableFabricCommitInCXXAnimated() &&
156
+ ReactNativeFeatureFlags.cxxNativeAnimatedRemoveJsSync();
157
+ if (!isJsSyncRemoved) {
159
158
  if (this.__isLooping === true) {
160
159
  return;
161
160
  }
@@ -185,9 +184,9 @@ export default class Animation {
185
184
  * callback will never be called more than once.
186
185
  */
187
186
  __notifyAnimationEnd(result: EndResult): void {
188
- const callback = this.#onEnd;
187
+ const callback = this._onEnd;
189
188
  if (callback != null) {
190
- this.#onEnd = null;
189
+ this._onEnd = null;
191
190
  callback(result);
192
191
  }
193
192
  }
@@ -49,6 +49,8 @@ export type TimingAnimationConfigSingle = $ReadOnly<{
49
49
 
50
50
  let _easeInOut;
51
51
  function easeInOut() {
52
+ /* $FlowFixMe[constant-condition] Error discovered during Constant Condition
53
+ * roll out. See https://fburl.com/workplace/1v97vimq. */
52
54
  if (!_easeInOut) {
53
55
  const Easing = require('../Easing').default;
54
56
  _easeInOut = Easing.inOut(Easing.ease);
@@ -54,7 +54,8 @@ const AnimatedScrollView: AnimatedComponentType<
54
54
  props.style != null
55
55
  ) {
56
56
  return (
57
- // $FlowFixMe - It should return an Animated ScrollView but it returns a ScrollView with Animated props applied.
57
+ // $FlowFixMe[incompatible-type] - It should return an Animated ScrollView but it returns a ScrollView with Animated props applied.
58
+ // $FlowFixMe[incompatible-variance]
58
59
  <AnimatedScrollViewWithInvertedRefreshControl
59
60
  scrollEventThrottle={0.0001}
60
61
  {...props}
@@ -89,7 +90,7 @@ const AnimatedScrollViewWithInvertedRefreshControl =
89
90
  const {intermediatePropsForRefreshControl, intermediatePropsForScrollView} =
90
91
  useMemo(() => {
91
92
  // $FlowFixMe[underconstrained-implicit-instantiation]
92
- // $FlowFixMe[incompatible-call]
93
+ // $FlowFixMe[incompatible-type]
93
94
  const {outer, inner} = splitLayoutProps(flattenStyle(props.style));
94
95
  return {
95
96
  intermediatePropsForRefreshControl: {style: outer},
@@ -14,7 +14,7 @@ import SectionList, {type SectionListProps} from '../../Lists/SectionList';
14
14
  import createAnimatedComponent from '../createAnimatedComponent';
15
15
  import * as React from 'react';
16
16
 
17
- // $FlowFixMe
17
+ // $FlowFixMe[incompatible-type]
18
18
  export default (createAnimatedComponent(SectionList): component<
19
19
  // $FlowExpectedError[unclear-type]
20
20
  ItemT = any,
@@ -60,12 +60,12 @@ function processColor(
60
60
  }
61
61
 
62
62
  if (isRgbaValue(color)) {
63
- // $FlowIgnore[incompatible-cast] - Type is verified above
63
+ // $FlowFixMe[incompatible-type] - Type is verified above
64
64
  return (color: RgbaValue);
65
65
  }
66
66
 
67
67
  let normalizedColor: ?ProcessedColorValue = normalizeColor(
68
- // $FlowIgnore[incompatible-cast] - Type is verified above
68
+ // $FlowFixMe[incompatible-type] - Type is verified above
69
69
  (color: ColorValue),
70
70
  );
71
71
  if (normalizedColor === undefined || normalizedColor === null) {
@@ -125,7 +125,7 @@ export default class AnimatedColor extends AnimatedWithChildren {
125
125
  let value: RgbaValue | RgbaAnimatedValue | ColorValue =
126
126
  valueIn ?? defaultColor;
127
127
  if (isRgbaAnimatedValue(value)) {
128
- // $FlowIgnore[incompatible-cast] - Type is verified above
128
+ // $FlowFixMe[incompatible-type] - Type is verified above
129
129
  const rgbaAnimatedValue: RgbaAnimatedValue = (value: RgbaAnimatedValue);
130
130
  this.r = rgbaAnimatedValue.r;
131
131
  this.g = rgbaAnimatedValue.g;
@@ -133,14 +133,14 @@ export default class AnimatedColor extends AnimatedWithChildren {
133
133
  this.a = rgbaAnimatedValue.a;
134
134
  } else {
135
135
  const processedColor: RgbaValue | NativeColorValue =
136
- // $FlowIgnore[incompatible-cast] - Type is verified above
136
+ // $FlowFixMe[incompatible-type] - Type is verified above
137
137
  processColor((value: ColorValue | RgbaValue)) ?? defaultColor;
138
138
  let initColor: RgbaValue = defaultColor;
139
139
  if (isRgbaValue(processedColor)) {
140
- // $FlowIgnore[incompatible-cast] - Type is verified above
140
+ // $FlowFixMe[incompatible-type] - Type is verified above
141
141
  initColor = (processedColor: RgbaValue);
142
142
  } else {
143
- // $FlowIgnore[incompatible-cast] - Type is verified above
143
+ // $FlowFixMe[incompatible-type] - Type is verified above
144
144
  this.nativeColor = (processedColor: NativeColorValue);
145
145
  }
146
146
 
@@ -170,7 +170,7 @@ export default class AnimatedColor extends AnimatedWithChildren {
170
170
  processColor(value) ?? defaultColor;
171
171
  this._withSuspendedCallbacks(() => {
172
172
  if (isRgbaValue(processedColor)) {
173
- // $FlowIgnore[incompatible-type] - Type is verified above
173
+ // $FlowFixMe[incompatible-type] - Type is verified above
174
174
  const rgbaValue: RgbaValue = processedColor;
175
175
  this.r.setValue(rgbaValue.r);
176
176
  this.g.setValue(rgbaValue.g);
@@ -181,7 +181,7 @@ export default class AnimatedColor extends AnimatedWithChildren {
181
181
  shouldUpdateNodeConfig = true;
182
182
  }
183
183
  } else {
184
- // $FlowIgnore[incompatible-type] - Type is verified above
184
+ // $FlowFixMe[incompatible-type] - Type is verified above
185
185
  const nativeColor: NativeColorValue = processedColor;
186
186
  if (this.nativeColor !== nativeColor) {
187
187
  this.nativeColor = nativeColor;
@@ -203,7 +203,7 @@ export default class AnimatedColor extends AnimatedWithChildren {
203
203
  flushValue(this);
204
204
  }
205
205
 
206
- // $FlowFixMe[incompatible-call]
206
+ // $FlowFixMe[incompatible-type]
207
207
  this.__callListeners(this.__getValue());
208
208
  }
209
209
 
@@ -224,7 +224,7 @@ function createStringInterpolation(
224
224
  outputRange.every(output =>
225
225
  output.components.every(
226
226
  (component, i) =>
227
- // $FlowIgnoreMe[invalid-compare]
227
+ // $FlowFixMe[invalid-compare]
228
228
  typeof component === 'number' || component === firstOutput[i],
229
229
  ),
230
230
  ),
@@ -235,9 +235,9 @@ function createStringInterpolation(
235
235
  const numericComponents: $ReadOnlyArray<$ReadOnlyArray<number>> =
236
236
  outputRange.map(output =>
237
237
  isColor
238
- ? // $FlowIgnoreMe[incompatible-call]
238
+ ? // $FlowFixMe[incompatible-type]
239
239
  output.components
240
- : // $FlowIgnoreMe[incompatible-call]
240
+ : // $FlowFixMe[incompatible-call]
241
241
  output.components.filter(c => typeof c === 'number'),
242
242
  );
243
243
  const interpolations = numericComponents[0].map((_, i) =>
@@ -393,7 +393,7 @@ export default class AnimatedInterpolation<
393
393
  let outputRange = this._config.outputRange;
394
394
  let outputType = null;
395
395
  if (typeof outputRange[0] === 'string') {
396
- // $FlowIgnoreMe[incompatible-cast]
396
+ // $FlowFixMe[incompatible-type]
397
397
  outputRange = ((outputRange: $ReadOnlyArray<string>).map(value => {
398
398
  const processedColor = processColor(value);
399
399
  if (typeof processedColor === 'number') {
@@ -17,6 +17,7 @@ type ValueListenerCallback = (state: {value: number, ...}) => mixed;
17
17
 
18
18
  export type AnimatedNodeConfig = $ReadOnly<{
19
19
  debugID?: string,
20
+ unstable_disableBatchingForNativeCreate?: boolean,
20
21
  }>;
21
22
 
22
23
  let _uniqueId = 1;
@@ -28,7 +29,7 @@ let _assertNativeAnimatedModule: ?() => void = () => {
28
29
  };
29
30
 
30
31
  export default class AnimatedNode {
31
- #listeners: Map<string, ValueListenerCallback>;
32
+ _listeners: Map<string, ValueListenerCallback>;
32
33
 
33
34
  _platformConfig: ?PlatformConfig = undefined;
34
35
 
@@ -38,10 +39,12 @@ export default class AnimatedNode {
38
39
  ...
39
40
  }>,
40
41
  ) {
41
- this.#listeners = new Map();
42
+ this._listeners = new Map();
42
43
  if (__DEV__) {
43
44
  this.__debugID = config?.debugID;
44
45
  }
46
+ this.__disableBatchingForNativeCreate =
47
+ config?.unstable_disableBatchingForNativeCreate;
45
48
  }
46
49
 
47
50
  __attach(): void {}
@@ -65,6 +68,7 @@ export default class AnimatedNode {
65
68
  /* Methods and props used by native Animated impl */
66
69
  __isNative: boolean = false;
67
70
  __nativeTag: ?number = undefined;
71
+ __disableBatchingForNativeCreate: ?boolean = undefined;
68
72
 
69
73
  __makeNative(platformConfig: ?PlatformConfig): void {
70
74
  // Subclasses are expected to set `__isNative` to true before this.
@@ -85,7 +89,7 @@ export default class AnimatedNode {
85
89
  */
86
90
  addListener(callback: (value: any) => mixed): string {
87
91
  const id = String(_uniqueId++);
88
- this.#listeners.set(id, callback);
92
+ this._listeners.set(id, callback);
89
93
  return id;
90
94
  }
91
95
 
@@ -96,7 +100,7 @@ export default class AnimatedNode {
96
100
  * See https://reactnative.dev/docs/animatedvalue#removelistener
97
101
  */
98
102
  removeListener(id: string): void {
99
- this.#listeners.delete(id);
103
+ this._listeners.delete(id);
100
104
  }
101
105
 
102
106
  /**
@@ -105,11 +109,11 @@ export default class AnimatedNode {
105
109
  * See https://reactnative.dev/docs/animatedvalue#removealllisteners
106
110
  */
107
111
  removeAllListeners(): void {
108
- this.#listeners.clear();
112
+ this._listeners.clear();
109
113
  }
110
114
 
111
115
  hasListeners(): boolean {
112
- return this.#listeners.size > 0;
116
+ return this._listeners.size > 0;
113
117
  }
114
118
 
115
119
  __onAnimatedValueUpdateReceived(value: number, offset: number): void {
@@ -118,7 +122,7 @@ export default class AnimatedNode {
118
122
 
119
123
  __callListeners(value: number): void {
120
124
  const event = {value};
121
- this.#listeners.forEach(listener => {
125
+ this._listeners.forEach(listener => {
122
126
  listener(event);
123
127
  });
124
128
  }
@@ -142,6 +146,9 @@ export default class AnimatedNode {
142
146
  if (this._platformConfig) {
143
147
  config.platformConfig = this._platformConfig;
144
148
  }
149
+ if (this.__disableBatchingForNativeCreate) {
150
+ config.disableBatchingForNativeCreate = true;
151
+ }
145
152
  NativeAnimatedHelper.API.createAnimatedNode(nativeTag, config);
146
153
  }
147
154
  return nativeTag;
@@ -21,7 +21,7 @@ const MAX_DEPTH = 5;
21
21
 
22
22
  export function isPlainObject(
23
23
  value: mixed,
24
- /* $FlowIssue[incompatible-type-guard] - Flow does not know that the prototype
24
+ /* $FlowFixMe[incompatible-type-guard] - Flow does not know that the prototype
25
25
  and ReactElement checks preserve the type refinement of `value`. */
26
26
  ): value is $ReadOnly<{[string]: mixed}> {
27
27
  return (
@@ -82,7 +82,7 @@ function mapAnimatedNodes(value: any, fn: any => any, depth: number = 0): any {
82
82
  }
83
83
 
84
84
  export default class AnimatedObject extends AnimatedWithChildren {
85
- #nodes: $ReadOnlyArray<AnimatedNode>;
85
+ _nodes: $ReadOnlyArray<AnimatedNode>;
86
86
  _value: mixed;
87
87
 
88
88
  /**
@@ -106,7 +106,7 @@ export default class AnimatedObject extends AnimatedWithChildren {
106
106
  config?: ?AnimatedNodeConfig,
107
107
  ) {
108
108
  super(config);
109
- this.#nodes = nodes;
109
+ this._nodes = nodes;
110
110
  this._value = value;
111
111
  }
112
112
 
@@ -117,7 +117,7 @@ export default class AnimatedObject extends AnimatedWithChildren {
117
117
  }
118
118
 
119
119
  __getValueWithStaticObject(staticObject: mixed): any {
120
- const nodes = this.#nodes;
120
+ const nodes = this._nodes;
121
121
  let index = 0;
122
122
  // NOTE: We can depend on `this._value` and `staticObject` sharing a
123
123
  // structure because of `useAnimatedPropsMemo`.
@@ -131,7 +131,7 @@ export default class AnimatedObject extends AnimatedWithChildren {
131
131
  }
132
132
 
133
133
  __attach(): void {
134
- const nodes = this.#nodes;
134
+ const nodes = this._nodes;
135
135
  for (let ii = 0, length = nodes.length; ii < length; ii++) {
136
136
  const node = nodes[ii];
137
137
  node.__addChild(this);
@@ -140,7 +140,7 @@ export default class AnimatedObject extends AnimatedWithChildren {
140
140
  }
141
141
 
142
142
  __detach(): void {
143
- const nodes = this.#nodes;
143
+ const nodes = this._nodes;
144
144
  for (let ii = 0, length = nodes.length; ii < length; ii++) {
145
145
  const node = nodes[ii];
146
146
  node.__removeChild(this);
@@ -149,7 +149,7 @@ export default class AnimatedObject extends AnimatedWithChildren {
149
149
  }
150
150
 
151
151
  __makeNative(platformConfig: ?PlatformConfig): void {
152
- const nodes = this.#nodes;
152
+ const nodes = this._nodes;
153
153
  for (let ii = 0, length = nodes.length; ii < length; ii++) {
154
154
  const node = nodes[ii];
155
155
  node.__makeNative(platformConfig);
@@ -92,11 +92,11 @@ function createAnimatedProps(
92
92
  }
93
93
 
94
94
  export default class AnimatedProps extends AnimatedNode {
95
- #callback: () => void;
96
- #nodeKeys: $ReadOnlyArray<string>;
97
- #nodes: $ReadOnlyArray<AnimatedNode>;
98
- #props: {[string]: mixed};
99
- #target: ?TargetView = null;
95
+ _callback: () => void;
96
+ _nodeKeys: $ReadOnlyArray<string>;
97
+ _nodes: $ReadOnlyArray<AnimatedNode>;
98
+ _props: {[string]: mixed};
99
+ _target: ?TargetView = null;
100
100
 
101
101
  constructor(
102
102
  inputProps: {[string]: mixed},
@@ -106,19 +106,19 @@ export default class AnimatedProps extends AnimatedNode {
106
106
  ) {
107
107
  super(config);
108
108
  const [nodeKeys, nodes, props] = createAnimatedProps(inputProps, allowlist);
109
- this.#nodeKeys = nodeKeys;
110
- this.#nodes = nodes;
111
- this.#props = props;
112
- this.#callback = callback;
109
+ this._nodeKeys = nodeKeys;
110
+ this._nodes = nodes;
111
+ this._props = props;
112
+ this._callback = callback;
113
113
  }
114
114
 
115
115
  __getValue(): Object {
116
116
  const props: {[string]: mixed} = {};
117
117
 
118
- const keys = Object.keys(this.#props);
118
+ const keys = Object.keys(this._props);
119
119
  for (let ii = 0, length = keys.length; ii < length; ii++) {
120
120
  const key = keys[ii];
121
- const value = this.#props[key];
121
+ const value = this._props[key];
122
122
 
123
123
  if (value instanceof AnimatedNode) {
124
124
  props[key] = value.__getValue();
@@ -143,7 +143,7 @@ export default class AnimatedProps extends AnimatedNode {
143
143
  const keys = Object.keys(staticProps);
144
144
  for (let ii = 0, length = keys.length; ii < length; ii++) {
145
145
  const key = keys[ii];
146
- const maybeNode = this.#props[key];
146
+ const maybeNode = this._props[key];
147
147
 
148
148
  if (key === 'style') {
149
149
  const staticStyle = staticProps.style;
@@ -176,10 +176,10 @@ export default class AnimatedProps extends AnimatedNode {
176
176
  __getNativeAnimatedEventTuples(): $ReadOnlyArray<[string, AnimatedEvent]> {
177
177
  const tuples = [];
178
178
 
179
- const keys = Object.keys(this.#props);
179
+ const keys = Object.keys(this._props);
180
180
  for (let ii = 0, length = keys.length; ii < length; ii++) {
181
181
  const key = keys[ii];
182
- const value = this.#props[key];
182
+ const value = this._props[key];
183
183
 
184
184
  if (value instanceof AnimatedEvent && value.__isNative) {
185
185
  tuples.push([key, value]);
@@ -192,8 +192,8 @@ export default class AnimatedProps extends AnimatedNode {
192
192
  __getAnimatedValue(): Object {
193
193
  const props: {[string]: mixed} = {};
194
194
 
195
- const nodeKeys = this.#nodeKeys;
196
- const nodes = this.#nodes;
195
+ const nodeKeys = this._nodeKeys;
196
+ const nodes = this._nodes;
197
197
  for (let ii = 0, length = nodes.length; ii < length; ii++) {
198
198
  const key = nodeKeys[ii];
199
199
  const node = nodes[ii];
@@ -204,7 +204,7 @@ export default class AnimatedProps extends AnimatedNode {
204
204
  }
205
205
 
206
206
  __attach(): void {
207
- const nodes = this.#nodes;
207
+ const nodes = this._nodes;
208
208
  for (let ii = 0, length = nodes.length; ii < length; ii++) {
209
209
  const node = nodes[ii];
210
210
  node.__addChild(this);
@@ -213,12 +213,12 @@ export default class AnimatedProps extends AnimatedNode {
213
213
  }
214
214
 
215
215
  __detach(): void {
216
- if (this.__isNative && this.#target != null) {
217
- this.#disconnectAnimatedView(this.#target);
216
+ if (this.__isNative && this._target != null) {
217
+ this.#disconnectAnimatedView(this._target);
218
218
  }
219
- this.#target = null;
219
+ this._target = null;
220
220
 
221
- const nodes = this.#nodes;
221
+ const nodes = this._nodes;
222
222
  for (let ii = 0, length = nodes.length; ii < length; ii++) {
223
223
  const node = nodes[ii];
224
224
  node.__removeChild(this);
@@ -228,11 +228,11 @@ export default class AnimatedProps extends AnimatedNode {
228
228
  }
229
229
 
230
230
  update(): void {
231
- this.#callback();
231
+ this._callback();
232
232
  }
233
233
 
234
234
  __makeNative(platformConfig: ?PlatformConfig): void {
235
- const nodes = this.#nodes;
235
+ const nodes = this._nodes;
236
236
  for (let ii = 0, length = nodes.length; ii < length; ii++) {
237
237
  const node = nodes[ii];
238
238
  node.__makeNative(platformConfig);
@@ -246,19 +246,19 @@ export default class AnimatedProps extends AnimatedNode {
246
246
  // where it will be needed to traverse the graph of attached values.
247
247
  super.__setPlatformConfig(platformConfig);
248
248
 
249
- if (this.#target != null) {
250
- this.#connectAnimatedView(this.#target);
249
+ if (this._target != null) {
250
+ this.#connectAnimatedView(this._target);
251
251
  }
252
252
  }
253
253
  }
254
254
 
255
255
  setNativeView(instance: TargetViewInstance): void {
256
- if (this.#target?.instance === instance) {
256
+ if (this._target?.instance === instance) {
257
257
  return;
258
258
  }
259
- this.#target = {instance, connectedViewTag: null};
259
+ this._target = {instance, connectedViewTag: null};
260
260
  if (this.__isNative) {
261
- this.#connectAnimatedView(this.#target);
261
+ this.#connectAnimatedView(this._target);
262
262
  }
263
263
  }
264
264
 
@@ -306,8 +306,8 @@ export default class AnimatedProps extends AnimatedNode {
306
306
  const platformConfig = this.__getPlatformConfig();
307
307
  const propsConfig: {[string]: number} = {};
308
308
 
309
- const nodeKeys = this.#nodeKeys;
310
- const nodes = this.#nodes;
309
+ const nodeKeys = this._nodeKeys;
310
+ const nodes = this._nodes;
311
311
  for (let ii = 0, length = nodes.length; ii < length; ii++) {
312
312
  const key = nodeKeys[ii];
313
313
  const node = nodes[ii];
@@ -325,8 +325,8 @@ export default class AnimatedProps extends AnimatedNode {
325
325
 
326
326
  // Supported versions of JSC do not implement the newer Object.hasOwn. Remove
327
327
  // this shim when they do.
328
- // $FlowIgnore[method-unbinding]
328
+ // $FlowFixMe[method-unbinding]
329
329
  const _hasOwnProp = Object.prototype.hasOwnProperty;
330
330
  const hasOwn: (obj: $ReadOnly<{...}>, prop: string) => boolean =
331
- // $FlowIgnore[method-unbinding]
331
+ // $FlowFixMe[method-unbinding]
332
332
  Object.hasOwn ?? ((obj, prop) => _hasOwnProp.call(obj, prop));
@@ -43,7 +43,7 @@ function createAnimatedStyle(
43
43
  if (value != null && key === 'transform') {
44
44
  node = ReactNativeFeatureFlags.shouldUseAnimatedObjectForTransform()
45
45
  ? AnimatedObject.from(value)
46
- : // $FlowFixMe[incompatible-call] - `value` is mixed.
46
+ : // $FlowFixMe[incompatible-type] - `value` is mixed.
47
47
  AnimatedTransform.from(value);
48
48
  } else if (value instanceof AnimatedNode) {
49
49
  node = value;
@@ -82,10 +82,10 @@ function createAnimatedStyle(
82
82
  }
83
83
 
84
84
  export default class AnimatedStyle extends AnimatedWithChildren {
85
- #originalStyleForWeb: ?mixed;
86
- #nodeKeys: $ReadOnlyArray<string>;
87
- #nodes: $ReadOnlyArray<AnimatedNode>;
88
- #style: {[string]: mixed};
85
+ _originalStyleForWeb: ?mixed;
86
+ _nodeKeys: $ReadOnlyArray<string>;
87
+ _nodes: $ReadOnlyArray<AnimatedNode>;
88
+ _style: {[string]: mixed};
89
89
 
90
90
  /**
91
91
  * Creates an `AnimatedStyle` if `value` contains `AnimatedNode` instances.
@@ -102,6 +102,8 @@ export default class AnimatedStyle extends AnimatedWithChildren {
102
102
  const [nodeKeys, nodes, style] = createAnimatedStyle(
103
103
  flatStyle,
104
104
  allowlist,
105
+ /* $FlowFixMe[invalid-compare] Error discovered during Constant Condition
106
+ * roll out. See https://fburl.com/workplace/4oq3zi07. */
105
107
  Platform.OS !== 'web',
106
108
  );
107
109
  if (nodes.length === 0) {
@@ -118,12 +120,12 @@ export default class AnimatedStyle extends AnimatedWithChildren {
118
120
  config?: ?AnimatedNodeConfig,
119
121
  ) {
120
122
  super(config);
121
- this.#nodeKeys = nodeKeys;
122
- this.#nodes = nodes;
123
- this.#style = style;
123
+ this._nodeKeys = nodeKeys;
124
+ this._nodes = nodes;
125
+ this._style = style;
124
126
 
125
127
  if ((Platform.OS as string) === 'web') {
126
- // $FlowIgnore[cannot-write] - Intentional shadowing.
128
+ // $FlowFixMe[cannot-write] - Intentional shadowing.
127
129
  this.__getValueForStyle = resultStyle => [
128
130
  originalStyleForWeb,
129
131
  resultStyle,
@@ -134,10 +136,10 @@ export default class AnimatedStyle extends AnimatedWithChildren {
134
136
  __getValue(): FlatStyleForWeb<FlatStyle> | FlatStyle {
135
137
  const style: {[string]: mixed} = {};
136
138
 
137
- const keys = Object.keys(this.#style);
139
+ const keys = Object.keys(this._style);
138
140
  for (let ii = 0, length = keys.length; ii < length; ii++) {
139
141
  const key = keys[ii];
140
- const value = this.#style[key];
142
+ const value = this._style[key];
141
143
 
142
144
  if (value instanceof AnimatedNode) {
143
145
  style[key] = value.__getValue();
@@ -166,7 +168,7 @@ export default class AnimatedStyle extends AnimatedWithChildren {
166
168
  const keys = Object.keys(style);
167
169
  for (let ii = 0, length = keys.length; ii < length; ii++) {
168
170
  const key = keys[ii];
169
- const maybeNode = this.#style[key];
171
+ const maybeNode = this._style[key];
170
172
 
171
173
  if (key === 'transform' && maybeNode instanceof AnimatedTransform) {
172
174
  style[key] = maybeNode.__getValueWithStaticTransforms(
@@ -185,8 +187,8 @@ export default class AnimatedStyle extends AnimatedWithChildren {
185
187
  __getAnimatedValue(): Object {
186
188
  const style: {[string]: mixed} = {};
187
189
 
188
- const nodeKeys = this.#nodeKeys;
189
- const nodes = this.#nodes;
190
+ const nodeKeys = this._nodeKeys;
191
+ const nodes = this._nodes;
190
192
  for (let ii = 0, length = nodes.length; ii < length; ii++) {
191
193
  const key = nodeKeys[ii];
192
194
  const node = nodes[ii];
@@ -197,7 +199,7 @@ export default class AnimatedStyle extends AnimatedWithChildren {
197
199
  }
198
200
 
199
201
  __attach(): void {
200
- const nodes = this.#nodes;
202
+ const nodes = this._nodes;
201
203
  for (let ii = 0, length = nodes.length; ii < length; ii++) {
202
204
  const node = nodes[ii];
203
205
  node.__addChild(this);
@@ -206,7 +208,7 @@ export default class AnimatedStyle extends AnimatedWithChildren {
206
208
  }
207
209
 
208
210
  __detach(): void {
209
- const nodes = this.#nodes;
211
+ const nodes = this._nodes;
210
212
  for (let ii = 0, length = nodes.length; ii < length; ii++) {
211
213
  const node = nodes[ii];
212
214
  node.__removeChild(this);
@@ -215,7 +217,7 @@ export default class AnimatedStyle extends AnimatedWithChildren {
215
217
  }
216
218
 
217
219
  __makeNative(platformConfig: ?PlatformConfig) {
218
- const nodes = this.#nodes;
220
+ const nodes = this._nodes;
219
221
  for (let ii = 0, length = nodes.length; ii < length; ii++) {
220
222
  const node = nodes[ii];
221
223
  node.__makeNative(platformConfig);
@@ -227,8 +229,8 @@ export default class AnimatedStyle extends AnimatedWithChildren {
227
229
  const platformConfig = this.__getPlatformConfig();
228
230
  const styleConfig: {[string]: ?number} = {};
229
231
 
230
- const nodeKeys = this.#nodeKeys;
231
- const nodes = this.#nodes;
232
+ const nodeKeys = this._nodeKeys;
233
+ const nodes = this._nodes;
232
234
  for (let ii = 0, length = nodes.length; ii < length; ii++) {
233
235
  const key = nodeKeys[ii];
234
236
  const node = nodes[ii];
@@ -249,8 +251,8 @@ export default class AnimatedStyle extends AnimatedWithChildren {
249
251
 
250
252
  // Supported versions of JSC do not implement the newer Object.hasOwn. Remove
251
253
  // this shim when they do.
252
- // $FlowIgnore[method-unbinding]
254
+ // $FlowFixMe[method-unbinding]
253
255
  const _hasOwnProp = Object.prototype.hasOwnProperty;
254
256
  const hasOwn: (obj: $ReadOnly<{...}>, prop: string) => boolean =
255
- // $FlowIgnore[method-unbinding]
257
+ // $FlowFixMe[method-unbinding]
256
258
  Object.hasOwn ?? ((obj, prop) => _hasOwnProp.call(obj, prop));