@office-iss/react-native-win32 0.71.5 → 0.72.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 (326) hide show
  1. package/.flowconfig +15 -3
  2. package/CHANGELOG.json +321 -45
  3. package/CHANGELOG.md +149 -26
  4. package/IntegrationTests/IntegrationTestHarnessTest.js +1 -0
  5. package/Libraries/ActionSheetIOS/ActionSheetIOS.js +1 -1
  6. package/Libraries/Alert/Alert.d.ts +4 -4
  7. package/Libraries/Alert/Alert.win32.js +1 -0
  8. package/Libraries/Animated/Animated.d.ts +17 -6
  9. package/Libraries/Animated/NativeAnimatedHelper.js +18 -6
  10. package/Libraries/Animated/NativeAnimatedHelper.win32.js +606 -0
  11. package/Libraries/Animated/bezier.js +1 -1
  12. package/Libraries/Animated/components/AnimatedFlatList.js +8 -3
  13. package/Libraries/Animated/components/AnimatedScrollView.js +4 -1
  14. package/Libraries/Animated/components/AnimatedSectionList.js +12 -3
  15. package/Libraries/Animated/createAnimatedComponent.js +26 -239
  16. package/Libraries/Animated/nodes/AnimatedColor.js +47 -80
  17. package/Libraries/Animated/nodes/AnimatedInterpolation.js +167 -121
  18. package/Libraries/Animated/nodes/AnimatedNode.js +3 -5
  19. package/Libraries/Animated/nodes/AnimatedProps.js +7 -6
  20. package/Libraries/Animated/nodes/AnimatedStyle.js +42 -8
  21. package/Libraries/Animated/nodes/AnimatedTransform.js +1 -1
  22. package/Libraries/Animated/nodes/AnimatedValue.js +8 -12
  23. package/Libraries/Animated/nodes/AnimatedWithChildren.js +1 -1
  24. package/Libraries/Animated/useAnimatedProps.js +7 -10
  25. package/Libraries/BatchedBridge/MessageQueue.js +2 -1
  26. package/Libraries/BatchedBridge/NativeModules.d.ts +1 -1
  27. package/Libraries/BatchedBridge/NativeModules.js +1 -0
  28. package/Libraries/Blob/Blob.js +4 -0
  29. package/Libraries/Blob/FileReader.js +30 -2
  30. package/Libraries/Blob/URL.js +3 -1
  31. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.d.ts +2 -2
  32. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +2 -3
  33. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +2 -3
  34. package/Libraries/Components/ActivityIndicator/ActivityIndicator.js +6 -4
  35. package/Libraries/Components/Button.js +3 -2
  36. package/Libraries/Components/Button.win32.js +451 -0
  37. package/Libraries/Components/Clipboard/Clipboard.js +1 -1
  38. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +4 -0
  39. package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +1 -0
  40. package/Libraries/Components/Pressable/Pressable.d.ts +1 -1
  41. package/Libraries/Components/Pressable/Pressable.js +1 -1
  42. package/Libraries/Components/RefreshControl/RefreshControl.js +1 -0
  43. package/Libraries/Components/SafeAreaView/SafeAreaView.js +1 -2
  44. package/Libraries/Components/SafeAreaView/SafeAreaView.win32.js +1 -2
  45. package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +12 -6
  46. package/Libraries/Components/ScrollView/ScrollView.d.ts +2 -2
  47. package/Libraries/Components/ScrollView/ScrollView.js +149 -91
  48. package/Libraries/Components/ScrollView/ScrollView.win32.js +1939 -0
  49. package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +16 -6
  50. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +5 -7
  51. package/Libraries/Components/ScrollView/ScrollViewViewConfig.js +1 -1
  52. package/Libraries/Components/StatusBar/StatusBar.js +3 -0
  53. package/Libraries/Components/Switch/Switch.js +3 -1
  54. package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +21 -11
  55. package/Libraries/Components/TextInput/InputAccessoryView.d.ts +1 -1
  56. package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +11 -5
  57. package/Libraries/Components/TextInput/TextInput.Types.win32.d.ts +51 -0
  58. package/Libraries/Components/TextInput/TextInput.Types.win32.js +3 -0
  59. package/Libraries/Components/TextInput/TextInput.Types.win32.js.map +1 -0
  60. package/Libraries/Components/TextInput/TextInput.d.ts +15 -5
  61. package/Libraries/Components/TextInput/TextInput.flow.js +1 -1
  62. package/Libraries/Components/TextInput/TextInput.js +130 -103
  63. package/Libraries/Components/TextInput/TextInput.win32.js +202 -890
  64. package/Libraries/Components/Touchable/Touchable.d.ts +1 -1
  65. package/Libraries/Components/Touchable/Touchable.flow.js +30 -4
  66. package/Libraries/Components/Touchable/Touchable.js +6 -3
  67. package/Libraries/Components/Touchable/Touchable.win32.js +6 -3
  68. package/Libraries/Components/Touchable/TouchableHighlight.js +1 -1
  69. package/Libraries/Components/Touchable/TouchableNativeFeedback.js +2 -2
  70. package/Libraries/Components/Touchable/TouchableOpacity.js +3 -0
  71. package/Libraries/Components/Touchable/TouchableWin32.js.map +1 -1
  72. package/Libraries/Components/Touchable/TouchableWithoutFeedback.d.ts +1 -1
  73. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +2 -2
  74. package/Libraries/Components/TraceUpdateOverlay/TraceUpdateOverlay.js +179 -0
  75. package/Libraries/Components/TraceUpdateOverlay/TraceUpdateOverlayNativeComponent.js +43 -0
  76. package/Libraries/Components/View/ReactNativeStyleAttributes.js +26 -0
  77. package/Libraries/Components/View/View.js +35 -16
  78. package/Libraries/Components/View/View.win32.js +38 -16
  79. package/Libraries/Components/View/ViewAccessibility.d.ts +6 -6
  80. package/Libraries/Components/View/ViewAccessibility.js +10 -1
  81. package/Libraries/Components/View/ViewAccessibility.win32.d.ts +5 -5
  82. package/Libraries/Components/View/ViewNativeComponent.js +32 -8
  83. package/Libraries/Components/View/ViewPropTypes.d.ts +1 -1
  84. package/Libraries/Components/View/ViewPropTypes.js +1 -1
  85. package/Libraries/Components/View/ViewPropTypes.win32.d.ts +1 -1
  86. package/Libraries/Components/View/ViewPropTypes.win32.js +1 -1
  87. package/Libraries/Components/View/ViewWin32.js +2 -35
  88. package/Libraries/Core/Devtools/openFileInEditor.js +1 -0
  89. package/Libraries/Core/Devtools/openURLInBrowser.js +1 -0
  90. package/Libraries/Core/Devtools/parseErrorStack.js +2 -2
  91. package/Libraries/Core/Devtools/parseHermesStack.js +54 -34
  92. package/Libraries/Core/ExceptionsManager.js +2 -2
  93. package/Libraries/Core/InitializeCore.js +2 -1
  94. package/Libraries/Core/ReactNativeVersion.js +3 -3
  95. package/Libraries/Core/ReactNativeVersionCheck.js +4 -8
  96. package/Libraries/Core/ReactNativeVersionCheck.win32.js +4 -8
  97. package/Libraries/Core/Timers/JSTimers.js +1 -1
  98. package/Libraries/Core/Timers/immediateShim.js +1 -0
  99. package/Libraries/Core/Timers/queueMicrotask.js +1 -1
  100. package/Libraries/Core/setUpAlert.js +1 -1
  101. package/Libraries/Core/setUpDOM.js +18 -0
  102. package/Libraries/Core/setUpDeveloperTools.js +1 -1
  103. package/Libraries/Core/setUpGlobals.js +5 -2
  104. package/Libraries/Core/setUpNavigator.js +6 -5
  105. package/Libraries/Core/setUpPerformance.js +23 -13
  106. package/Libraries/Core/setUpReactDevTools.js +2 -0
  107. package/Libraries/Core/setUpSegmentFetcher.js +0 -41
  108. package/Libraries/Core/setUpTimers.js +2 -2
  109. package/Libraries/DOM/Geometry/DOMRect.js +82 -0
  110. package/Libraries/DOM/Geometry/DOMRectReadOnly.js +188 -0
  111. package/Libraries/DOM/Nodes/ReactNativeElement.js +75 -0
  112. package/Libraries/DOM/Nodes/ReadOnlyElement.js +89 -0
  113. package/Libraries/DOM/Nodes/ReadOnlyNode.js +167 -0
  114. package/Libraries/DOM/OldStyleCollections/ArrayLikeUtils.js +46 -0
  115. package/Libraries/DOM/OldStyleCollections/DOMRectList.js +76 -0
  116. package/Libraries/DOM/OldStyleCollections/HTMLCollection.js +82 -0
  117. package/Libraries/DOM/OldStyleCollections/NodeList.js +104 -0
  118. package/Libraries/DevToolsSettings/DevToolsSettingsManager.android.js +35 -0
  119. package/Libraries/DevToolsSettings/DevToolsSettingsManager.d.ts +20 -0
  120. package/Libraries/DevToolsSettings/DevToolsSettingsManager.ios.js +49 -0
  121. package/Libraries/DevToolsSettings/DevToolsSettingsManager.win32.js +35 -0
  122. package/Libraries/DevToolsSettings/NativeDevToolsSettingsManager.js +24 -0
  123. package/Libraries/EventEmitter/NativeEventEmitter.d.ts +1 -2
  124. package/Libraries/EventEmitter/RCTDeviceEventEmitter.d.ts +1 -2
  125. package/Libraries/EventEmitter/RCTDeviceEventEmitter.js +9 -1
  126. package/Libraries/Events/EventPolyfill.js +1 -1
  127. package/Libraries/Image/AssetRegistry.js +1 -1
  128. package/Libraries/Image/AssetSourceResolver.js +3 -3
  129. package/Libraries/Image/Image.android.js +4 -1
  130. package/Libraries/Image/Image.d.ts +63 -2
  131. package/Libraries/Image/Image.ios.js +3 -0
  132. package/Libraries/Image/Image.win32.js +3 -0
  133. package/Libraries/Image/ImageBackground.js +1 -0
  134. package/Libraries/Image/ImageProps.js +1 -1
  135. package/Libraries/Image/ImageViewNativeComponent.js +4 -4
  136. package/Libraries/Image/RelativeImageStub.js +1 -1
  137. package/Libraries/Image/TextInlineImageNativeComponent.js +1 -1
  138. package/Libraries/Image/resolveAssetSource.js +1 -1
  139. package/Libraries/Inspector/DevtoolsOverlay.js +26 -19
  140. package/Libraries/Inspector/ElementBox.js +4 -1
  141. package/Libraries/Inspector/Inspector.js +5 -6
  142. package/Libraries/Inspector/Inspector.win32.js +7 -6
  143. package/Libraries/Inspector/InspectorOverlay.js +3 -3
  144. package/Libraries/Inspector/InspectorOverlay.win32.js +2 -1
  145. package/Libraries/Inspector/NetworkOverlay.js +1 -1
  146. package/Libraries/Interaction/JSEventLoopWatchdog.js +1 -1
  147. package/Libraries/Interaction/PanResponder.js +5 -6
  148. package/Libraries/LayoutAnimation/LayoutAnimation.js +2 -1
  149. package/Libraries/Linking/Linking.js +1 -4
  150. package/Libraries/Lists/FillRateHelper.js +4 -238
  151. package/Libraries/Lists/FlatList.d.ts +15 -22
  152. package/Libraries/Lists/FlatList.js +9 -6
  153. package/Libraries/Lists/SectionList.d.ts +10 -6
  154. package/Libraries/Lists/SectionList.js +5 -3
  155. package/Libraries/Lists/SectionListModern.js +3 -3
  156. package/Libraries/Lists/ViewabilityHelper.js +8 -344
  157. package/Libraries/Lists/VirtualizeUtils.js +4 -244
  158. package/Libraries/Lists/VirtualizedList.js +10 -1867
  159. package/Libraries/Lists/VirtualizedListContext.js +6 -104
  160. package/Libraries/Lists/VirtualizedSectionList.js +9 -602
  161. package/Libraries/Lists/__flowtests__/FlatList-flowtest.js +1 -0
  162. package/Libraries/Lists/__flowtests__/SectionList-flowtest.js +1 -1
  163. package/Libraries/LogBox/Data/LogBoxData.js +1 -1
  164. package/Libraries/LogBox/Data/parseLogBoxLog.js +1 -1
  165. package/Libraries/LogBox/LogBox.js +1 -1
  166. package/Libraries/LogBox/UI/LogBoxInspector.js +1 -3
  167. package/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.win32.js +168 -0
  168. package/Libraries/LogBox/UI/LogBoxInspectorHeader.win32.js +3 -0
  169. package/Libraries/LogBox/UI/LogBoxInspectorReactFrames.win32.js +193 -0
  170. package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js +1 -0
  171. package/Libraries/LogBox/UI/LogBoxInspectorStackFrame.js +2 -2
  172. package/Libraries/LogBox/UI/LogBoxInspectorStackFrame.win32.js +7 -3
  173. package/Libraries/LogBox/UI/LogBoxMessage.js +87 -5
  174. package/Libraries/LogBox/UI/LogBoxNotification.js +5 -7
  175. package/Libraries/Modal/Modal.js +2 -2
  176. package/Libraries/NativeComponent/BaseViewConfig.android.js +32 -12
  177. package/Libraries/NativeComponent/BaseViewConfig.ios.js +43 -19
  178. package/Libraries/NativeComponent/BaseViewConfig.win32.js +43 -19
  179. package/Libraries/NativeComponent/NativeComponentRegistryUnstable.js +4 -1
  180. package/Libraries/NativeComponent/ViewConfig.js +1 -0
  181. package/Libraries/NativeComponent/ViewConfigIgnore.js +1 -4
  182. package/Libraries/Network/RCTNetworking.android.js +2 -2
  183. package/Libraries/Network/RCTNetworking.ios.js +1 -1
  184. package/Libraries/Network/RCTNetworking.win32.js +1 -1
  185. package/Libraries/Network/XMLHttpRequest.js +1 -1
  186. package/Libraries/Pressability/Pressability.js +10 -4
  187. package/Libraries/Pressability/Pressability.win32.js +9 -3
  188. package/Libraries/ReactNative/AppContainer.js +7 -1
  189. package/Libraries/ReactNative/AppRegistry.d.ts +1 -1
  190. package/Libraries/ReactNative/AppRegistry.js +10 -13
  191. package/Libraries/ReactNative/FabricUIManager.js +24 -8
  192. package/Libraries/ReactNative/NativeUIManager.js +5 -5
  193. package/Libraries/ReactNative/ReactNativeFeatureFlags.js +10 -10
  194. package/Libraries/ReactNative/UIManager.js +168 -1
  195. package/Libraries/ReactNative/getCachedComponentWithDebugName.js +5 -5
  196. package/Libraries/ReactNative/getNativeComponentAttributes.js +1 -1
  197. package/Libraries/ReactNative/requireNativeComponent.d.ts +1 -1
  198. package/Libraries/ReactNative/requireNativeComponent.js +1 -1
  199. package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +1 -0
  200. package/Libraries/Renderer/implementations/ReactFabric-dev.js +26 -3
  201. package/Libraries/Renderer/implementations/ReactFabric-prod.js +13 -1
  202. package/Libraries/Renderer/implementations/ReactFabric-profiling.js +13 -1
  203. package/Libraries/Renderer/public/ReactFabricPublicInstanceUtils.js +38 -0
  204. package/Libraries/Renderer/shims/ReactNativeTypes.js +6 -6
  205. package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +7 -7
  206. package/Libraries/Renderer/shims/createReactNativeComponentClass.js +2 -2
  207. package/Libraries/Share/Share.js +1 -1
  208. package/Libraries/StyleSheet/PlatformColorValueTypes.ios.js +1 -1
  209. package/Libraries/StyleSheet/StyleSheet.js +1 -1
  210. package/Libraries/StyleSheet/StyleSheet.win32.js +1 -1
  211. package/Libraries/StyleSheet/StyleSheetTypes.d.ts +115 -76
  212. package/Libraries/StyleSheet/StyleSheetTypes.js +188 -33
  213. package/Libraries/StyleSheet/flattenStyle.js +2 -0
  214. package/Libraries/StyleSheet/normalizeColor.js +1 -1
  215. package/Libraries/StyleSheet/processColor.js +1 -1
  216. package/Libraries/Text/Text.d.ts +12 -2
  217. package/Libraries/Text/Text.js +50 -41
  218. package/Libraries/Text/TextProps.js +3 -4
  219. package/Libraries/TurboModule/samples/NativeSampleTurboModule.js +6 -0
  220. package/Libraries/Types/CodegenTypes.js +1 -0
  221. package/Libraries/UTFSequence.js +3 -1
  222. package/Libraries/Utilities/Appearance.d.ts +10 -0
  223. package/Libraries/Utilities/Appearance.js +13 -0
  224. package/Libraries/Utilities/Dimensions.js +1 -1
  225. package/Libraries/Utilities/Dimensions.win32.js +1 -1
  226. package/Libraries/Utilities/GlobalPerformanceLogger.js +12 -1
  227. package/Libraries/Utilities/HMRClient.js +16 -10
  228. package/Libraries/Utilities/{createPerformanceLogger.d.ts → IPerformanceLogger.d.ts} +4 -4
  229. package/Libraries/Utilities/IPerformanceLogger.js +49 -0
  230. package/Libraries/Utilities/LoadingView.android.js +28 -11
  231. package/Libraries/Utilities/NativeAppearance.js +1 -0
  232. package/Libraries/Utilities/NativePlatformConstantsWin.js +1 -1
  233. package/Libraries/Utilities/PixelRatio.js +2 -2
  234. package/Libraries/Utilities/Platform.win32.js +1 -1
  235. package/Libraries/Utilities/ReactNativeTestTools.js +1 -1
  236. package/Libraries/Utilities/__mocks__/PixelRatio.js +1 -1
  237. package/Libraries/Utilities/codegenNativeCommands.js +2 -0
  238. package/Libraries/Utilities/createPerformanceLogger.js +55 -43
  239. package/Libraries/Utilities/stringifySafe.js +2 -7
  240. package/Libraries/Utilities/useColorScheme.win32.js +26 -0
  241. package/Libraries/Utilities/useWindowDimensions.js +3 -3
  242. package/Libraries/WebPerformance/EventCounts.js +78 -0
  243. package/Libraries/WebPerformance/MemoryInfo.js +54 -0
  244. package/Libraries/WebPerformance/NativePerformance.js +38 -0
  245. package/Libraries/WebPerformance/NativePerformanceObserver.js +22 -7
  246. package/Libraries/WebPerformance/Performance.js +312 -0
  247. package/Libraries/WebPerformance/PerformanceEntry.js +45 -0
  248. package/Libraries/WebPerformance/PerformanceEventTiming.js +38 -0
  249. package/Libraries/WebPerformance/PerformanceObserver.js +196 -101
  250. package/Libraries/WebPerformance/RawPerformanceEntry.js +87 -0
  251. package/Libraries/WebPerformance/ReactNativeStartupTiming.js +65 -0
  252. package/Libraries/WebPerformance/__mocks__/NativePerformance.js +65 -0
  253. package/Libraries/WebPerformance/__mocks__/NativePerformanceObserver.js +101 -0
  254. package/Libraries/YellowBox/YellowBoxDeprecated.js +1 -1
  255. package/Libraries/vendor/core/ErrorUtils.js +1 -1
  256. package/Libraries/vendor/emitter/EventEmitter.d.ts +2 -2
  257. package/Libraries/vendor/emitter/EventEmitter.js +9 -1
  258. package/flow/global.js +29 -4
  259. package/flow/jest.js +258 -164
  260. package/flow/use-sync-external-store.js +1 -0
  261. package/index.js +56 -42
  262. package/index.win32.js +56 -42
  263. package/interface.js +1 -1
  264. package/jest/local-setup.js +33 -0
  265. package/jest/mockComponent.js +4 -2
  266. package/jest/mockNativeComponent.js +1 -1
  267. package/jest/mockScrollView.js +2 -1
  268. package/jest/react-native-env.js +1 -3
  269. package/jest/setup.js +11 -8
  270. package/overrides.json +122 -85
  271. package/package.json +40 -30
  272. package/rn-get-polyfills.js +1 -1
  273. package/src/Libraries/Components/TextInput/TextInput.Types.win32.ts +68 -0
  274. package/src/Libraries/Components/Touchable/TouchableWin32.tsx +3 -3
  275. package/src/Libraries/Components/View/ViewAccessibility.win32.d.ts +5 -5
  276. package/src/Libraries/Components/View/ViewPropTypes.win32.d.ts +1 -1
  277. package/types/index.d.ts +2 -6
  278. package/types/modules/Codegen.d.ts +4 -4
  279. package/types/modules/globals.d.ts +27 -25
  280. package/types/public/DeprecatedPropertiesAlias.d.ts +0 -20
  281. package/types/public/ReactNativeRenderer.d.ts +2 -7
  282. package/Libraries/Animated/createAnimatedComponentInjection.js +0 -48
  283. package/Libraries/Animated/createAnimatedComponent_EXPERIMENTAL.js +0 -48
  284. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.flow.js +0 -208
  285. package/Libraries/Components/ActivityIndicator/ActivityIndicator.flow.js +0 -58
  286. package/Libraries/Components/DatePicker/DatePickerIOS.android.js +0 -47
  287. package/Libraries/Components/DatePicker/DatePickerIOS.d.ts +0 -92
  288. package/Libraries/Components/DatePicker/DatePickerIOS.flow.android.js +0 -14
  289. package/Libraries/Components/DatePicker/DatePickerIOS.flow.ios.js +0 -113
  290. package/Libraries/Components/DatePicker/DatePickerIOS.ios.js +0 -242
  291. package/Libraries/Components/DatePicker/DatePickerIOS.win32.js +0 -47
  292. package/Libraries/Components/DatePicker/RCTDatePickerNativeComponent.js +0 -60
  293. package/Libraries/Components/DatePickerAndroid/NativeDatePickerAndroid.js +0 -26
  294. package/Libraries/Components/ProgressViewIOS/ProgressViewIOS.android.js +0 -45
  295. package/Libraries/Components/ProgressViewIOS/ProgressViewIOS.d.ts +0 -62
  296. package/Libraries/Components/ProgressViewIOS/ProgressViewIOS.ios.js +0 -75
  297. package/Libraries/Components/ProgressViewIOS/ProgressViewIOS.win32.js +0 -45
  298. package/Libraries/Components/ProgressViewIOS/RCTProgressViewNativeComponent.js +0 -33
  299. package/Libraries/Components/SafeAreaView/SafeAreaView.flow.js +0 -19
  300. package/Libraries/Components/Slider/Slider.d.ts +0 -132
  301. package/Libraries/Components/Slider/Slider.js +0 -282
  302. package/Libraries/Components/Slider/SliderNativeComponent.js +0 -56
  303. package/Libraries/Components/TextInput/Win32TextInputNativeComponent.js +0 -23
  304. package/Libraries/Interaction/Batchinator.js +0 -76
  305. package/Libraries/Interaction/BridgeSpyStallHandler.js +0 -63
  306. package/Libraries/Interaction/InteractionStallDebugger.js +0 -23
  307. package/Libraries/Interaction/PanResponder.flow.js +0 -257
  308. package/Libraries/Lists/CellRenderMask.js +0 -155
  309. package/Libraries/Lists/ChildListCollection.js +0 -72
  310. package/Libraries/Lists/StateSafePureComponent.js +0 -85
  311. package/Libraries/Lists/VirtualizedList.d.ts +0 -347
  312. package/Libraries/Lists/VirtualizedListCellRenderer.js +0 -259
  313. package/Libraries/Lists/VirtualizedListProps.js +0 -279
  314. package/Libraries/Performance/PureComponentDebug.js +0 -74
  315. package/Libraries/Reliability/UserFlow.js +0 -158
  316. package/Libraries/Renderer/implementations/ReactNativeRenderer.d.ts +0 -149
  317. package/Libraries/Renderer/shims/ReactNativeTypes.d.ts +0 -141
  318. package/Libraries/Utilities/MatrixMath.js +0 -748
  319. package/Libraries/Utilities/buildStyleInterpolator.js +0 -209
  320. package/Libraries/Utilities/clamp.js +0 -23
  321. package/Libraries/Utilities/deprecatedPropType.js +0 -36
  322. package/Libraries/Utilities/groupByEveryN.js +0 -51
  323. package/Libraries/Utilities/mergeIntoFast.js +0 -26
  324. package/Libraries/Utilities/setAndForwardRef.js +0 -71
  325. package/Libraries/Utilities/truncate.js +0 -51
  326. package/flow/JSITimerInternalType.js +0 -30
@@ -8,19 +8,11 @@
8
8
  * @format
9
9
  */
10
10
 
11
- 'use strict';
12
-
13
11
  import View from '../Components/View/View';
14
- import setAndForwardRef from '../Utilities/setAndForwardRef';
15
- import {AnimatedEvent} from './AnimatedEvent';
16
- import * as createAnimatedComponentInjection from './createAnimatedComponentInjection';
17
- import NativeAnimatedHelper from './NativeAnimatedHelper';
18
- import AnimatedProps from './nodes/AnimatedProps';
19
- import invariant from 'invariant';
12
+ import useMergeRefs from '../Utilities/useMergeRefs';
13
+ import useAnimatedProps from './useAnimatedProps';
20
14
  import * as React from 'react';
21
15
 
22
- let animatedComponentNextId = 1;
23
-
24
16
  export type AnimatedComponentType<
25
17
  -Props: {+[string]: mixed, ...},
26
18
  +Instance = mixed,
@@ -37,238 +29,33 @@ export type AnimatedComponentType<
37
29
  Instance,
38
30
  >;
39
31
 
40
- function createAnimatedComponent<Props: {+[string]: mixed, ...}, Instance>(
41
- Component: React.AbstractComponent<Props, Instance>,
42
- ): AnimatedComponentType<Props, Instance> {
43
- invariant(
44
- typeof Component !== 'function' ||
45
- (Component.prototype && Component.prototype.isReactComponent),
46
- '`createAnimatedComponent` does not support stateless functional components; ' +
47
- 'use a class component instead.',
48
- );
49
-
50
- class AnimatedComponent extends React.Component<Object> {
51
- _component: any; // TODO T53738161: flow type this, and the whole file
52
- _invokeAnimatedPropsCallbackOnMount: boolean = false;
53
- _prevComponent: any;
54
- _propsAnimated: AnimatedProps;
55
- _eventDetachers: Array<Function> = [];
56
-
57
- // Only to be used in this file, and only in Fabric.
58
- _animatedComponentId: string = `${animatedComponentNextId++}:animatedComponent`;
59
-
60
- _attachNativeEvents() {
61
- // Make sure to get the scrollable node for components that implement
62
- // `ScrollResponder.Mixin`.
63
- const scrollableNode = this._component?.getScrollableNode
64
- ? this._component.getScrollableNode()
65
- : this._component;
66
-
67
- for (const key in this.props) {
68
- const prop = this.props[key];
69
- if (prop instanceof AnimatedEvent && prop.__isNative) {
70
- prop.__attach(scrollableNode, key);
71
- this._eventDetachers.push(() => prop.__detach(scrollableNode, key));
72
- }
73
- }
74
- }
75
-
76
- _detachNativeEvents() {
77
- this._eventDetachers.forEach(remove => remove());
78
- this._eventDetachers = [];
79
- }
80
-
81
- _isFabric = (): boolean => {
82
- // When called during the first render, `_component` is always null.
83
- // Therefore, even if a component is rendered in Fabric, we can't detect
84
- // that until ref is set, which happens sometime after the first render.
85
- // In cases where this value switching between "false" and "true" on Fabric
86
- // causes issues, add an additional check for _component nullity.
87
- if (this._component == null) {
88
- return false;
89
- }
90
- return (
91
- // eslint-disable-next-line dot-notation
92
- this._component['_internalInstanceHandle']?.stateNode?.canonical !=
93
- null ||
94
- // Some components have a setNativeProps function but aren't a host component
95
- // such as lists like FlatList and SectionList. These should also use
96
- // forceUpdate in Fabric since setNativeProps doesn't exist on the underlying
97
- // host component. This crazy hack is essentially special casing those lists and
98
- // ScrollView itself to use forceUpdate in Fabric.
99
- // If these components end up using forwardRef then these hacks can go away
100
- // as this._component would actually be the underlying host component and the above check
101
- // would be sufficient.
102
- (this._component.getNativeScrollRef != null &&
103
- this._component.getNativeScrollRef() != null &&
104
- // eslint-disable-next-line dot-notation
105
- this._component.getNativeScrollRef()['_internalInstanceHandle']
106
- ?.stateNode?.canonical != null) ||
107
- (this._component.getScrollResponder != null &&
108
- this._component.getScrollResponder() != null &&
109
- this._component.getScrollResponder().getNativeScrollRef != null &&
110
- this._component.getScrollResponder().getNativeScrollRef() != null &&
111
- this._component.getScrollResponder().getNativeScrollRef()[
112
- // eslint-disable-next-line dot-notation
113
- '_internalInstanceHandle'
114
- ]?.stateNode?.canonical != null)
115
- );
116
- };
117
-
118
- _waitForUpdate = (): void => {
119
- if (this._isFabric()) {
120
- NativeAnimatedHelper.API.setWaitingForIdentifier(
121
- this._animatedComponentId,
122
- );
123
- }
124
- };
125
-
126
- _markUpdateComplete = (): void => {
127
- if (this._isFabric()) {
128
- NativeAnimatedHelper.API.unsetWaitingForIdentifier(
129
- this._animatedComponentId,
130
- );
131
- }
132
- };
133
-
134
- // The system is best designed when setNativeProps is implemented. It is
135
- // able to avoid re-rendering and directly set the attributes that changed.
136
- // However, setNativeProps can only be implemented on leaf native
137
- // components. If you want to animate a composite component, you need to
138
- // re-render it. In this case, we have a fallback that uses forceUpdate.
139
- // This fallback is also called in Fabric.
140
- _animatedPropsCallback = (): void => {
141
- if (this._component == null) {
142
- // AnimatedProps is created in will-mount because it's used in render.
143
- // But this callback may be invoked before mount in async mode,
144
- // In which case we should defer the setNativeProps() call.
145
- // React may throw away uncommitted work in async mode,
146
- // So a deferred call won't always be invoked.
147
- this._invokeAnimatedPropsCallbackOnMount = true;
148
- } else if (
149
- process.env.NODE_ENV === 'test' ||
150
- // For animating properties of non-leaf/non-native components
151
- typeof this._component.setNativeProps !== 'function' ||
152
- // In Fabric, force animations to go through forceUpdate and skip setNativeProps
153
- this._isFabric()
154
- ) {
155
- this.forceUpdate();
156
- } else if (!this._propsAnimated.__isNative) {
157
- this._component.setNativeProps(
158
- this._propsAnimated.__getAnimatedValue(),
159
- );
160
- } else {
161
- throw new Error(
162
- 'Attempting to run JS driven animation on animated ' +
163
- 'node that has been moved to "native" earlier by starting an ' +
164
- 'animation with `useNativeDriver: true`',
165
- );
166
- }
167
- };
168
-
169
- _attachProps(nextProps: any) {
170
- const oldPropsAnimated = this._propsAnimated;
171
-
172
- this._propsAnimated = new AnimatedProps(
173
- nextProps,
174
- this._animatedPropsCallback,
175
- );
176
- this._propsAnimated.__attach();
177
-
178
- // When you call detach, it removes the element from the parent list
179
- // of children. If it goes to 0, then the parent also detaches itself
180
- // and so on.
181
- // An optimization is to attach the new elements and THEN detach the old
182
- // ones instead of detaching and THEN attaching.
183
- // This way the intermediate state isn't to go to 0 and trigger
184
- // this expensive recursive detaching to then re-attach everything on
185
- // the very next operation.
186
- if (oldPropsAnimated) {
187
- oldPropsAnimated.__restoreDefaultValues();
188
- oldPropsAnimated.__detach();
189
- }
190
- }
191
-
192
- _setComponentRef: (ref: React.ElementRef<any>) => void = setAndForwardRef({
193
- getForwardedRef: () => this.props.forwardedRef,
194
- setLocalRef: ref => {
195
- this._prevComponent = this._component;
196
- this._component = ref;
197
- },
198
- });
199
-
200
- render(): React.Node {
201
- const animatedProps = this._propsAnimated.__getValue() || {};
202
-
203
- const {style = {}, ...props} = animatedProps;
204
- const {style: passthruStyle = {}, ...passthruProps} =
205
- this.props.passthroughAnimatedPropExplicitValues || {};
206
- const mergedStyle = {...style, ...passthruStyle};
207
-
208
- // Force `collapsable` to be false so that native view is not flattened.
209
- // Flattened views cannot be accurately referenced by a native driver.
210
- return (
211
- <Component
212
- {...props}
213
- {...passthruProps}
214
- collapsable={false}
215
- style={mergedStyle}
216
- ref={this._setComponentRef}
217
- />
218
- );
219
- }
220
-
221
- UNSAFE_componentWillMount() {
222
- this._waitForUpdate();
223
- this._attachProps(this.props);
224
- }
225
-
226
- componentDidMount() {
227
- if (this._invokeAnimatedPropsCallbackOnMount) {
228
- this._invokeAnimatedPropsCallbackOnMount = false;
229
- this._animatedPropsCallback();
230
- }
231
-
232
- this._propsAnimated.setNativeView(this._component);
233
- this._attachNativeEvents();
234
- this._markUpdateComplete();
235
- }
236
-
237
- UNSAFE_componentWillReceiveProps(newProps: any) {
238
- this._waitForUpdate();
239
- this._attachProps(newProps);
240
- }
241
-
242
- componentDidUpdate(prevProps: any) {
243
- if (this._component !== this._prevComponent) {
244
- this._propsAnimated.setNativeView(this._component);
245
- }
246
- if (this._component !== this._prevComponent || prevProps !== this.props) {
247
- this._detachNativeEvents();
248
- this._attachNativeEvents();
249
- }
250
- this._markUpdateComplete();
251
- }
252
-
253
- componentWillUnmount() {
254
- this._propsAnimated && this._propsAnimated.__detach();
255
- this._detachNativeEvents();
256
- this._markUpdateComplete();
257
- this._component = null;
258
- this._prevComponent = null;
259
- }
260
- }
32
+ export default function createAnimatedComponent<TProps: {...}, TInstance>(
33
+ Component: React.AbstractComponent<TProps, TInstance>,
34
+ ): AnimatedComponentType<TProps, TInstance> {
35
+ return React.forwardRef((props, forwardedRef) => {
36
+ const [reducedProps, callbackRef] = useAnimatedProps<TProps, TInstance>(
37
+ // $FlowFixMe[incompatible-call]
38
+ props,
39
+ );
40
+ const ref = useMergeRefs<TInstance | null>(callbackRef, forwardedRef);
41
+
42
+ // Some components require explicit passthrough values for animation
43
+ // to work properly. For example, if an animated component is
44
+ // transformed and Pressable, onPress will not work after transform
45
+ // without these passthrough values.
46
+ // $FlowFixMe[prop-missing]
47
+ const {passthroughAnimatedPropExplicitValues, style} = reducedProps;
48
+ const {style: passthroughStyle, ...passthroughProps} =
49
+ passthroughAnimatedPropExplicitValues ?? {};
50
+ const mergedStyle = {...style, ...passthroughStyle};
261
51
 
262
- return React.forwardRef(function AnimatedComponentWrapper(props, ref) {
263
52
  return (
264
- <AnimatedComponent
265
- {...props}
266
- {...(ref == null ? null : {forwardedRef: ref})}
53
+ <Component
54
+ {...reducedProps}
55
+ {...passthroughProps}
56
+ style={mergedStyle}
57
+ ref={ref}
267
58
  />
268
59
  );
269
60
  });
270
61
  }
271
-
272
- // $FlowIgnore[incompatible-cast] - Will be compatible after refactors.
273
- export default (createAnimatedComponentInjection.recordAndRetrieve() ??
274
- createAnimatedComponent: typeof createAnimatedComponent);
@@ -18,7 +18,7 @@ import type {PlatformConfig} from '../AnimatedPlatformConfig';
18
18
  import normalizeColor from '../../StyleSheet/normalizeColor';
19
19
  import {processColorObject} from '../../StyleSheet/PlatformColorValueTypes';
20
20
  import NativeAnimatedHelper from '../NativeAnimatedHelper';
21
- import AnimatedValue from './AnimatedValue';
21
+ import AnimatedValue, {flushValue} from './AnimatedValue';
22
22
  import AnimatedWithChildren from './AnimatedWithChildren';
23
23
 
24
24
  export type AnimatedColorConfig = $ReadOnly<{
@@ -43,10 +43,11 @@ type RgbaAnimatedValue = {
43
43
  ...
44
44
  };
45
45
 
46
+ export type InputValue = ?(RgbaValue | RgbaAnimatedValue | ColorValue);
47
+
46
48
  const NativeAnimatedAPI = NativeAnimatedHelper.API;
47
49
 
48
50
  const defaultColor: RgbaValue = {r: 0, g: 0, b: 0, a: 1.0};
49
- let _uniqueId = 1;
50
51
 
51
52
  /* eslint no-bitwise: 0 */
52
53
  function processColor(
@@ -113,22 +114,12 @@ export default class AnimatedColor extends AnimatedWithChildren {
113
114
  b: AnimatedValue;
114
115
  a: AnimatedValue;
115
116
  nativeColor: ?NativeColorValue;
116
- _listeners: {
117
- [key: string]: {
118
- r: string,
119
- g: string,
120
- b: string,
121
- a: string,
122
- ...
123
- },
124
- ...
125
- } = {};
126
-
127
- constructor(
128
- valueIn?: ?(RgbaValue | RgbaAnimatedValue | ColorValue),
129
- config?: ?AnimatedColorConfig,
130
- ) {
117
+
118
+ _suspendCallbacks: number = 0;
119
+
120
+ constructor(valueIn?: InputValue, config?: ?AnimatedColorConfig) {
131
121
  super();
122
+
132
123
  let value: RgbaValue | RgbaAnimatedValue | ColorValue =
133
124
  valueIn ?? defaultColor;
134
125
  if (isRgbaAnimatedValue(value)) {
@@ -156,7 +147,8 @@ export default class AnimatedColor extends AnimatedWithChildren {
156
147
  this.b = new AnimatedValue(initColor.b);
157
148
  this.a = new AnimatedValue(initColor.a);
158
149
  }
159
- if (this.nativeColor || (config && config.useNativeDriver)) {
150
+
151
+ if (config?.useNativeDriver) {
160
152
  this.__makeNative();
161
153
  }
162
154
  }
@@ -174,25 +166,27 @@ export default class AnimatedColor extends AnimatedWithChildren {
174
166
 
175
167
  const processedColor: RgbaValue | NativeColorValue =
176
168
  processColor(value) ?? defaultColor;
177
- if (isRgbaValue(processedColor)) {
178
- // $FlowIgnore[incompatible-type] - Type is verified above
179
- const rgbaValue: RgbaValue = processedColor;
180
- this.r.setValue(rgbaValue.r);
181
- this.g.setValue(rgbaValue.g);
182
- this.b.setValue(rgbaValue.b);
183
- this.a.setValue(rgbaValue.a);
184
- if (this.nativeColor != null) {
185
- this.nativeColor = null;
186
- shouldUpdateNodeConfig = true;
187
- }
188
- } else {
189
- // $FlowIgnore[incompatible-type] - Type is verified above
190
- const nativeColor: NativeColorValue = processedColor;
191
- if (this.nativeColor !== nativeColor) {
192
- this.nativeColor = nativeColor;
193
- shouldUpdateNodeConfig = true;
169
+ this._withSuspendedCallbacks(() => {
170
+ if (isRgbaValue(processedColor)) {
171
+ // $FlowIgnore[incompatible-type] - Type is verified above
172
+ const rgbaValue: RgbaValue = processedColor;
173
+ this.r.setValue(rgbaValue.r);
174
+ this.g.setValue(rgbaValue.g);
175
+ this.b.setValue(rgbaValue.b);
176
+ this.a.setValue(rgbaValue.a);
177
+ if (this.nativeColor != null) {
178
+ this.nativeColor = null;
179
+ shouldUpdateNodeConfig = true;
180
+ }
181
+ } else {
182
+ // $FlowIgnore[incompatible-type] - Type is verified above
183
+ const nativeColor: NativeColorValue = processedColor;
184
+ if (this.nativeColor !== nativeColor) {
185
+ this.nativeColor = nativeColor;
186
+ shouldUpdateNodeConfig = true;
187
+ }
194
188
  }
195
- }
189
+ });
196
190
 
197
191
  if (this.__isNative) {
198
192
  const nativeTag = this.__getNativeTag();
@@ -203,7 +197,12 @@ export default class AnimatedColor extends AnimatedWithChildren {
203
197
  );
204
198
  }
205
199
  NativeAnimatedAPI.unsetWaitingForIdentifier(nativeTag.toString());
200
+ } else {
201
+ flushValue(this);
206
202
  }
203
+
204
+ // $FlowFixMe[incompatible-call]
205
+ this.__callListeners(this.__getValue());
207
206
  }
208
207
 
209
208
  /**
@@ -240,50 +239,6 @@ export default class AnimatedColor extends AnimatedWithChildren {
240
239
  this.a.extractOffset();
241
240
  }
242
241
 
243
- /**
244
- * Adds an asynchronous listener to the value so you can observe updates from
245
- * animations. This is useful because there is no way to synchronously read
246
- * the value because it might be driven natively.
247
- *
248
- * Returns a string that serves as an identifier for the listener.
249
- */
250
- addListener(callback: ColorListenerCallback): string {
251
- const id = String(_uniqueId++);
252
- const jointCallback = ({value: number}: any) => {
253
- callback(this.__getValue());
254
- };
255
- this._listeners[id] = {
256
- r: this.r.addListener(jointCallback),
257
- g: this.g.addListener(jointCallback),
258
- b: this.b.addListener(jointCallback),
259
- a: this.a.addListener(jointCallback),
260
- };
261
- return id;
262
- }
263
-
264
- /**
265
- * Unregister a listener. The `id` param shall match the identifier
266
- * previously returned by `addListener()`.
267
- */
268
- removeListener(id: string): void {
269
- this.r.removeListener(this._listeners[id].r);
270
- this.g.removeListener(this._listeners[id].g);
271
- this.b.removeListener(this._listeners[id].b);
272
- this.a.removeListener(this._listeners[id].a);
273
- delete this._listeners[id];
274
- }
275
-
276
- /**
277
- * Remove all registered listeners.
278
- */
279
- removeAllListeners(): void {
280
- this.r.removeAllListeners();
281
- this.g.removeAllListeners();
282
- this.b.removeAllListeners();
283
- this.a.removeAllListeners();
284
- this._listeners = {};
285
- }
286
-
287
242
  /**
288
243
  * Stops any running animation or tracking. `callback` is invoked with the
289
244
  * final value after stopping the animation, which is useful for updating
@@ -332,6 +287,18 @@ export default class AnimatedColor extends AnimatedWithChildren {
332
287
  super.__detach();
333
288
  }
334
289
 
290
+ _withSuspendedCallbacks(callback: () => void) {
291
+ this._suspendCallbacks++;
292
+ callback();
293
+ this._suspendCallbacks--;
294
+ }
295
+
296
+ __callListeners(value: number): void {
297
+ if (this._suspendCallbacks === 0) {
298
+ super.__callListeners(value);
299
+ }
300
+ }
301
+
335
302
  __makeNative(platformConfig: ?PlatformConfig) {
336
303
  this.r.__makeNative(platformConfig);
337
304
  this.g.__makeNative(platformConfig);