@office-iss/react-native-win32 0.72.8 → 0.73.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 (277) hide show
  1. package/.flowconfig +15 -5
  2. package/CHANGELOG.json +530 -101
  3. package/CHANGELOG.md +213 -56
  4. package/IntegrationTests/PromiseTest.js +1 -0
  5. package/IntegrationTests/websocket_integration_test_server.js +1 -1
  6. package/Libraries/Animated/Animated.js +1 -1
  7. package/Libraries/Animated/AnimatedImplementation.js +1 -1
  8. package/Libraries/Animated/NativeAnimatedHelper.js +14 -10
  9. package/Libraries/Animated/NativeAnimatedHelper.win32.js +16 -12
  10. package/Libraries/Animated/NativeAnimatedModule.js +6 -2
  11. package/Libraries/Animated/NativeAnimatedTurboModule.js +7 -4
  12. package/Libraries/Animated/animations/Animation.js +57 -3
  13. package/Libraries/Animated/animations/DecayAnimation.js +9 -0
  14. package/Libraries/Animated/animations/SpringAnimation.js +8 -0
  15. package/Libraries/Animated/animations/TimingAnimation.js +8 -0
  16. package/Libraries/Animated/components/AnimatedFlatList.js +2 -1
  17. package/Libraries/Animated/components/AnimatedScrollView.js +2 -0
  18. package/Libraries/Animated/components/AnimatedSectionList.js +2 -1
  19. package/Libraries/Animated/createAnimatedComponent.js +1 -0
  20. package/Libraries/Animated/nodes/AnimatedColor.js +1 -1
  21. package/Libraries/Animated/nodes/AnimatedObject.js +146 -0
  22. package/Libraries/Animated/nodes/AnimatedProps.js +19 -7
  23. package/Libraries/Animated/nodes/AnimatedStyle.js +29 -55
  24. package/Libraries/Animated/nodes/AnimatedValueXY.js +3 -17
  25. package/Libraries/Animated/shouldUseTurboAnimatedModule.js +17 -0
  26. package/Libraries/Animated/useAnimatedProps.js +9 -10
  27. package/Libraries/AppState/AppState.d.ts +1 -1
  28. package/Libraries/AppState/NativeAppState.js +8 -4
  29. package/Libraries/BatchedBridge/MessageQueue.js +45 -36
  30. package/Libraries/Blob/Blob.js +6 -2
  31. package/Libraries/Blob/BlobManager.js +9 -10
  32. package/Libraries/Blob/BlobRegistry.js +14 -9
  33. package/Libraries/Blob/File.js +1 -1
  34. package/Libraries/Blob/FileReader.js +1 -2
  35. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.d.ts +1 -5
  36. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +7 -48
  37. package/Libraries/Components/Button/ButtonWin32.Props.d.ts +1 -1
  38. package/Libraries/Components/Button/ButtonWin32.Props.js.map +1 -1
  39. package/Libraries/Components/Button/ButtonWin32.d.ts +1 -1
  40. package/Libraries/Components/Button/ButtonWin32.js +1 -4
  41. package/Libraries/Components/Button/ButtonWin32.js.map +1 -1
  42. package/Libraries/Components/Clipboard/Clipboard.d.ts +4 -4
  43. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +3 -1
  44. package/Libraries/Components/EnterString.win32.d.ts +1 -1
  45. package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +26 -6
  46. package/Libraries/Components/Pressable/Pressable.js +3 -2
  47. package/Libraries/Components/Pressable/Pressable.win32.js +4 -3
  48. package/Libraries/Components/Pressable/useAndroidRippleForView.js +1 -1
  49. package/Libraries/Components/SafeAreaView/SafeAreaView.js +7 -7
  50. package/Libraries/Components/SafeAreaView/SafeAreaView.win32.js +7 -8
  51. package/Libraries/Components/ScrollView/ScrollView.js +3 -1
  52. package/Libraries/Components/ScrollView/ScrollView.win32.js +3 -1
  53. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +39 -46
  54. package/Libraries/Components/Switch/Switch.js +1 -0
  55. package/Libraries/Components/Text/TextWin32.d.ts +1 -1
  56. package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +1 -0
  57. package/Libraries/Components/TextInput/TextInput.d.ts +49 -7
  58. package/Libraries/Components/TextInput/TextInput.flow.js +43 -10
  59. package/Libraries/Components/TextInput/TextInput.js +62 -10
  60. package/Libraries/Components/TextInput/TextInput.win32.js +953 -206
  61. package/Libraries/Components/TextInput/Win32TextInputNativeComponent.js +23 -0
  62. package/Libraries/Components/ToastAndroid/{ToastAndroid.ios.js → ToastAndroid.js} +9 -1
  63. package/Libraries/Components/ToastAndroid/ToastAndroid.win32.js +9 -1
  64. package/Libraries/Components/Touchable/Tests/TouchableWin32Test.js +2 -2
  65. package/Libraries/Components/Touchable/Tests/TouchableWin32Test.js.map +1 -1
  66. package/Libraries/Components/Touchable/TouchableBounce.js +1 -1
  67. package/Libraries/Components/Touchable/TouchableHighlight.js +1 -1
  68. package/Libraries/Components/Touchable/TouchableNativeFeedback.js +1 -1
  69. package/Libraries/Components/Touchable/TouchableOpacity.js +4 -1
  70. package/Libraries/Components/Touchable/TouchableWin32.d.ts +1 -1
  71. package/Libraries/Components/Touchable/TouchableWin32.js.map +1 -1
  72. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +1 -0
  73. package/Libraries/Components/TraceUpdateOverlay/TraceUpdateOverlay.js +16 -6
  74. package/Libraries/Components/View/ReactNativeStyleAttributes.js +9 -0
  75. package/Libraries/Components/View/ReactNativeViewAttributes.js +1 -0
  76. package/Libraries/Components/View/ReactNativeViewAttributes.win32.js +1 -0
  77. package/Libraries/Components/View/View.js +46 -32
  78. package/Libraries/Components/View/View.win32.js +37 -6
  79. package/Libraries/Components/View/ViewAccessibility.d.ts +8 -2
  80. package/Libraries/Components/View/ViewNativeComponent.js +1 -0
  81. package/Libraries/Components/View/ViewPropTypes.js +18 -3
  82. package/Libraries/Components/View/ViewPropTypes.win32.js +30 -4
  83. package/Libraries/Components/View/ViewWin32.js +3 -2
  84. package/Libraries/Core/Devtools/loadBundleFromServer.js +152 -0
  85. package/Libraries/Core/Devtools/symbolicateStackTrace.js +2 -1
  86. package/Libraries/Core/ExceptionsManager.js +16 -7
  87. package/Libraries/Core/ExtendedError.js +12 -0
  88. package/Libraries/Core/ReactNativeVersion.js +3 -3
  89. package/Libraries/Core/ReactNativeVersionCheck.js +0 -2
  90. package/Libraries/Core/ReactNativeVersionCheck.win32.js +0 -2
  91. package/Libraries/Core/__mocks__/NativeExceptionsManager.js +20 -0
  92. package/Libraries/Core/setUpDeveloperTools.js +5 -1
  93. package/Libraries/Core/setUpIntersectionObserver.js +16 -0
  94. package/Libraries/{Components/ProgressBarAndroid/ProgressBarAndroid.ios.js → Core/setUpMutationObserver.js} +6 -2
  95. package/Libraries/Core/setUpPerformance.js +6 -13
  96. package/Libraries/Core/setUpPerformanceObserver.js +16 -0
  97. package/Libraries/Core/setUpRegeneratorRuntime.js +4 -2
  98. package/Libraries/DOM/Nodes/ReactNativeElement.js +135 -18
  99. package/Libraries/DOM/Nodes/ReadOnlyCharacterData.js +72 -0
  100. package/Libraries/DOM/Nodes/ReadOnlyElement.js +209 -21
  101. package/Libraries/DOM/Nodes/ReadOnlyNode.js +206 -17
  102. package/Libraries/DOM/Nodes/ReadOnlyText.js +30 -0
  103. package/Libraries/DOM/Nodes/Utilities/Traversal.js +54 -0
  104. package/Libraries/EventEmitter/NativeEventEmitter.d.ts +0 -6
  105. package/Libraries/EventEmitter/RCTDeviceEventEmitter.js +15 -4
  106. package/Libraries/Image/Image.android.js +8 -2
  107. package/Libraries/Image/Image.d.ts +1 -1
  108. package/Libraries/Image/Image.ios.js +4 -1
  109. package/Libraries/Image/Image.win32.js +6 -3
  110. package/Libraries/Image/ImageBackground.js +3 -0
  111. package/Libraries/Image/resolveAssetSource.win32.js +1 -1
  112. package/Libraries/Inspector/DevtoolsOverlay.js +6 -3
  113. package/Libraries/Inspector/NetworkOverlay.js +2 -2
  114. package/Libraries/Interaction/JSEventLoopWatchdog.js +1 -5
  115. package/Libraries/Interaction/PanResponder.js +1 -4
  116. package/Libraries/IntersectionObserver/IntersectionObserver.js +252 -0
  117. package/Libraries/IntersectionObserver/IntersectionObserverEntry.js +140 -0
  118. package/Libraries/IntersectionObserver/IntersectionObserverManager.js +221 -0
  119. package/Libraries/IntersectionObserver/NativeIntersectionObserver.js +41 -0
  120. package/Libraries/IntersectionObserver/__mocks__/NativeIntersectionObserver.js +162 -0
  121. package/Libraries/LayoutAnimation/LayoutAnimation.js +1 -1
  122. package/Libraries/Lists/FlatList.d.ts +2 -1
  123. package/Libraries/Lists/FlatList.js +15 -5
  124. package/Libraries/Lists/SectionList.js +4 -0
  125. package/Libraries/LogBox/Data/LogBoxData.js +2 -1
  126. package/Libraries/LogBox/Data/LogBoxLog.js +4 -1
  127. package/Libraries/LogBox/Data/LogBoxSymbolication.js +5 -2
  128. package/Libraries/LogBox/Data/parseLogBoxLog.js +57 -20
  129. package/Libraries/LogBox/UI/AnsiHighlight.js +1 -1
  130. package/Libraries/LogBox/UI/LogBoxInspectorFooter.js +24 -31
  131. package/Libraries/LogBox/UI/LogBoxInspectorHeader.js +1 -1
  132. package/Libraries/LogBox/UI/LogBoxMessage.js +4 -7
  133. package/Libraries/MutationObserver/MutationObserver.js +184 -0
  134. package/Libraries/MutationObserver/MutationObserverManager.js +218 -0
  135. package/Libraries/MutationObserver/MutationRecord.js +82 -0
  136. package/Libraries/MutationObserver/NativeMutationObserver.js +58 -0
  137. package/Libraries/MutationObserver/__mocks__/NativeMutationObserver.js +327 -0
  138. package/Libraries/NativeComponent/BaseViewConfig.android.js +18 -3
  139. package/Libraries/NativeComponent/BaseViewConfig.ios.js +33 -0
  140. package/Libraries/NativeComponent/BaseViewConfig.win32.js +33 -0
  141. package/Libraries/NativeComponent/NativeComponentRegistry.js +13 -9
  142. package/Libraries/NativeModules/specs/NativeSourceCode.js +6 -6
  143. package/Libraries/Network/RCTNetworking.android.js +2 -1
  144. package/Libraries/Network/XMLHttpRequest.js +1 -1
  145. package/Libraries/NewAppScreen/components/DebugInstructions.js +4 -4
  146. package/Libraries/NewAppScreen/components/LearnMoreLinks.js +9 -2
  147. package/Libraries/Performance/QuickPerformanceLogger.js +1 -1
  148. package/Libraries/PermissionsAndroid/NativePermissionsAndroid.js +1 -0
  149. package/Libraries/PermissionsAndroid/PermissionsAndroid.d.ts +1 -0
  150. package/Libraries/PermissionsAndroid/PermissionsAndroid.js +3 -1
  151. package/Libraries/Pressability/Pressability.js +28 -3
  152. package/Libraries/Pressability/Pressability.win32.js +30 -5
  153. package/Libraries/ReactNative/AppContainer.js +2 -3
  154. package/Libraries/ReactNative/AppRegistry.d.ts +0 -5
  155. package/Libraries/ReactNative/AppRegistry.js +66 -53
  156. package/Libraries/ReactNative/BridgelessUIManager.js +38 -9
  157. package/Libraries/ReactNative/FabricUIManager.js +143 -34
  158. package/Libraries/ReactNative/I18nManager.js +5 -11
  159. package/Libraries/ReactNative/NativeI18nManager.js +7 -5
  160. package/Libraries/ReactNative/PaperUIManager.win32.js +2 -2
  161. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +151 -0
  162. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +81 -0
  163. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactNativeAttributePayload.js +492 -0
  164. package/Libraries/ReactNative/ReactFabricPublicInstance/warnForStyleProps.js +32 -0
  165. package/Libraries/ReactNative/ReactNativeFeatureFlags.js +19 -3
  166. package/Libraries/ReactNative/UIManager.js +8 -0
  167. package/Libraries/ReactNative/__mocks__/FabricUIManager.js +648 -0
  168. package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +38 -2
  169. package/Libraries/Renderer/implementations/ReactFabric-dev.js +27 -27
  170. package/Libraries/Renderer/implementations/ReactFabric-prod.js +3 -3
  171. package/Libraries/Renderer/implementations/ReactFabric-profiling.js +3 -3
  172. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +27 -27
  173. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +3 -3
  174. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +3 -3
  175. package/Libraries/Renderer/shims/ReactFabric.js +5 -6
  176. package/Libraries/Renderer/shims/ReactFeatureFlags.js +2 -3
  177. package/Libraries/Renderer/shims/ReactNative.js +2 -3
  178. package/Libraries/Renderer/shims/ReactNativeTypes.js +35 -17
  179. package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +3 -3
  180. package/Libraries/Renderer/shims/createReactNativeComponentClass.js +2 -3
  181. package/Libraries/Settings/{Settings.android.js → Settings.js} +4 -4
  182. package/Libraries/Share/Share.d.ts +3 -9
  183. package/Libraries/StyleSheet/PlatformColorValueTypes.android.js +9 -4
  184. package/Libraries/StyleSheet/PlatformColorValueTypes.ios.js +28 -13
  185. package/Libraries/StyleSheet/PlatformColorValueTypes.win32.js +14 -4
  186. package/Libraries/StyleSheet/PlatformColorValueTypesIOS.ios.js +1 -1
  187. package/Libraries/StyleSheet/PlatformColorValueTypesWin32.d.ts +1 -1
  188. package/Libraries/StyleSheet/StyleSheet.d.ts +10 -1
  189. package/Libraries/StyleSheet/StyleSheet.js +3 -0
  190. package/Libraries/StyleSheet/StyleSheet.win32.js +3 -0
  191. package/Libraries/StyleSheet/StyleSheetTypes.d.ts +31 -17
  192. package/Libraries/StyleSheet/StyleSheetTypes.js +90 -6
  193. package/Libraries/StyleSheet/flattenStyle.js +4 -0
  194. package/Libraries/StyleSheet/private/_TransformStyle.js +16 -2
  195. package/Libraries/StyleSheet/processColor.js +1 -2
  196. package/Libraries/StyleSheet/processTransformOrigin.js +136 -0
  197. package/Libraries/StyleSheet/splitLayoutProps.js +1 -0
  198. package/Libraries/Text/Text.d.ts +5 -5
  199. package/Libraries/Text/Text.js +17 -10
  200. package/Libraries/Text/Text.win32.js +354 -0
  201. package/Libraries/Text/TextProps.win32.js +281 -0
  202. package/Libraries/TurboModule/TurboModuleRegistry.js +47 -7
  203. package/Libraries/TurboModule/samples/NativeSampleTurboModule.js +6 -0
  204. package/Libraries/Types/CoreEventTypes.d.ts +5 -2
  205. package/Libraries/Utilities/GlobalPerformanceLogger.js +2 -12
  206. package/Libraries/Utilities/NativeDeviceInfo.js +8 -9
  207. package/Libraries/Utilities/NativePlatformConstantsAndroid.js +23 -18
  208. package/Libraries/Utilities/NativePlatformConstantsIOS.js +16 -13
  209. package/Libraries/Utilities/NativePlatformConstantsWin.js +13 -10
  210. package/Libraries/Utilities/PerformanceLoggerContext.js +1 -1
  211. package/Libraries/Utilities/Platform.android.js +12 -8
  212. package/Libraries/Utilities/Platform.d.ts +1 -0
  213. package/Libraries/Utilities/Platform.flow.js +84 -0
  214. package/Libraries/Utilities/Platform.flow.win32.js +111 -0
  215. package/Libraries/Utilities/Platform.ios.js +12 -8
  216. package/Libraries/Utilities/Platform.win32.js +12 -8
  217. package/Libraries/Utilities/PolyfillFunctions.js +1 -1
  218. package/Libraries/Utilities/ReactNativeTestTools.js +1 -2
  219. package/Libraries/Utilities/SceneTracker.js +1 -1
  220. package/Libraries/Utilities/createPerformanceLogger.js +63 -32
  221. package/Libraries/Utilities/useColorScheme.js +7 -8
  222. package/Libraries/WebPerformance/MemoryInfo.js +1 -1
  223. package/Libraries/WebPerformance/NativePerformance.js +3 -8
  224. package/Libraries/WebPerformance/NativePerformanceObserver.js +4 -0
  225. package/Libraries/WebPerformance/Performance.js +42 -15
  226. package/Libraries/WebPerformance/PerformanceEntry.js +14 -6
  227. package/Libraries/WebPerformance/PerformanceEventTiming.js +18 -1
  228. package/Libraries/WebPerformance/ReactNativeStartupTiming.js +40 -14
  229. package/Libraries/WebPerformance/__mocks__/NativePerformance.js +4 -2
  230. package/Libraries/WebPerformance/__mocks__/NativePerformanceObserver.js +21 -3
  231. package/Libraries/promiseRejectionTrackingOptions.js +21 -9
  232. package/Libraries/vendor/emitter/EventEmitter.js +17 -17
  233. package/flow/global.js +1 -3
  234. package/flow/jest.js +5 -1
  235. package/{Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.ios.js → jest/ReactNativeInternalFeatureFlagsMock.js} +2 -1
  236. package/jest/__tests__/setup-test.js +18 -0
  237. package/jest/mockModal.js +6 -4
  238. package/jest/setup.js +61 -30
  239. package/jest.config.js +1 -1
  240. package/just-task.js +1 -0
  241. package/overrides.json +54 -60
  242. package/package.json +35 -33
  243. package/src/Libraries/Components/Button/ButtonWin32.Props.ts +1 -1
  244. package/src/Libraries/Components/Button/ButtonWin32.tsx +0 -2
  245. package/src/Libraries/Components/Touchable/Tests/TouchableWin32Test.tsx +2 -2
  246. package/src/Libraries/Components/Touchable/TouchableWin32.tsx +1 -1
  247. package/src/Libraries/Components/View/ViewAccessibility.d.ts +8 -2
  248. package/src/Libraries/StyleSheet/PlatformColorValueTypesWin32.d.ts +1 -1
  249. package/types/experimental.d.ts +44 -0
  250. package/types/index.d.ts +2 -1
  251. package/types/modules/Devtools.d.ts +1 -0
  252. package/types/modules/globals.d.ts +16 -1
  253. package/IntegrationTests/BUCK +0 -32
  254. package/IntegrationTests/PropertiesUpdateTest.js +0 -29
  255. package/IntegrationTests/RCTRootViewIntegrationTestApp.js +0 -86
  256. package/IntegrationTests/ReactContentSizeUpdateTest.js +0 -89
  257. package/IntegrationTests/SizeFlexibilityUpdateTest.js +0 -106
  258. package/Libraries/Components/AccessibilityInfo/NativeAccessibilityInfoWin32.js +0 -37
  259. package/Libraries/Components/TextInput/TextInput.Types.win32.d.ts +0 -51
  260. package/Libraries/Components/TextInput/TextInput.Types.win32.js +0 -3
  261. package/Libraries/Components/TextInput/TextInput.Types.win32.js.map +0 -1
  262. package/Libraries/Utilities/AcessibilityMapping.js +0 -154
  263. package/Libraries/Utilities/AcessibilityMapping.win32.js +0 -156
  264. package/Libraries/Utilities/NativeDevSplitBundleLoader.js +0 -19
  265. package/Libraries/Utilities/useColorScheme.win32.js +0 -26
  266. package/flow/use-sync-external-store.js +0 -20
  267. package/flow-typed/npm/base64-js_v1.x.x.js +0 -12
  268. package/flow-typed/npm/glob_v7.x.x.js +0 -79
  269. package/flow-typed/npm/pretty-format_v26.x.x.js +0 -49
  270. package/flow-typed/npm/promise_v8.x.x.js +0 -30
  271. package/flow-typed/npm/react-dom_v17.x.x.js +0 -139
  272. package/flow-typed/npm/react-test-renderer_v16.x.x.js +0 -79
  273. package/flow-typed/npm/stacktrace-parser_v0.1.x.js +0 -17
  274. package/flow-typed/npm/yargs_v17.x.x.js +0 -341
  275. package/src/Libraries/Components/AccessibilityInfo/AccessibilityInfo.d.ts +0 -161
  276. package/src/Libraries/Components/TextInput/TextInput.Types.win32.ts +0 -68
  277. /package/Libraries/{Renderer/public → ReactNative/ReactFabricPublicInstance}/ReactFabricPublicInstanceUtils.js +0 -0
@@ -85,6 +85,15 @@ export default class DecayAnimation extends Animation {
85
85
  this._onUpdate = onUpdate;
86
86
  this.__onEnd = onEnd;
87
87
  this._startTime = Date.now();
88
+
89
+ if (!this._useNativeDriver && animatedValue.__isNative === true) {
90
+ throw new Error(
91
+ 'Attempting to run JS driven animation on animated node ' +
92
+ 'that has been moved to "native" earlier by starting an ' +
93
+ 'animation with `useNativeDriver: true`',
94
+ );
95
+ }
96
+
88
97
  if (this._useNativeDriver) {
89
98
  this.__startNativeAnimation(animatedValue);
90
99
  } else {
@@ -221,6 +221,14 @@ export default class SpringAnimation extends Animation {
221
221
  }
222
222
 
223
223
  const start = () => {
224
+ if (!this._useNativeDriver && animatedValue.__isNative === true) {
225
+ throw new Error(
226
+ 'Attempting to run JS driven animation on animated node ' +
227
+ 'that has been moved to "native" earlier by starting an ' +
228
+ 'animation with `useNativeDriver: true`',
229
+ );
230
+ }
231
+
224
232
  if (this._useNativeDriver) {
225
233
  this.__startNativeAnimation(animatedValue);
226
234
  } else {
@@ -112,6 +112,14 @@ export default class TimingAnimation extends Animation {
112
112
  this.__onEnd = onEnd;
113
113
 
114
114
  const start = () => {
115
+ if (!this._useNativeDriver && animatedValue.__isNative === true) {
116
+ throw new Error(
117
+ 'Attempting to run JS driven animation on animated node ' +
118
+ 'that has been moved to "native" earlier by starting an ' +
119
+ 'animation with `useNativeDriver: true`',
120
+ );
121
+ }
122
+
115
123
  // Animations that sometimes have 0 duration and sometimes do not
116
124
  // still need to use the native driver when duration is 0 so as to
117
125
  // not cause intermixed JS and native animations.
@@ -18,12 +18,13 @@ import * as React from 'react';
18
18
  * @see https://github.com/facebook/react-native/commit/b8c8562
19
19
  */
20
20
  const FlatListWithEventThrottle = React.forwardRef(
21
+ // $FlowFixMe[incompatible-call]
21
22
  (
22
23
  props: React.ElementConfig<typeof FlatList>,
23
24
  ref:
24
25
  | ((null | FlatList<mixed>) => mixed)
25
26
  | {current: null | FlatList<mixed>, ...},
26
- ) => <FlatList scrollEventThrottle={0.0001} {...props} ref={ref} />,
27
+ ) => <FlatList {...props} ref={ref} />,
27
28
  );
28
29
 
29
30
  export default (createAnimatedComponent(
@@ -61,6 +61,7 @@ const AnimatedScrollView: AnimatedComponentType<Props, Instance> =
61
61
  });
62
62
 
63
63
  const AnimatedScrollViewWithInvertedRefreshControl = React.forwardRef(
64
+ // $FlowFixMe[incompatible-call]
64
65
  (
65
66
  props: {
66
67
  ...React.ElementConfig<typeof ScrollView>,
@@ -76,6 +77,7 @@ const AnimatedScrollViewWithInvertedRefreshControl = React.forwardRef(
76
77
  const {intermediatePropsForRefreshControl, intermediatePropsForScrollView} =
77
78
  useMemo(() => {
78
79
  // $FlowFixMe[underconstrained-implicit-instantiation]
80
+ // $FlowFixMe[incompatible-call]
79
81
  const {outer, inner} = splitLayoutProps(flattenStyle(props.style));
80
82
  return {
81
83
  intermediatePropsForRefreshControl: {style: outer},
@@ -19,6 +19,7 @@ import * as React from 'react';
19
19
  * @see https://github.com/facebook/react-native/commit/b8c8562
20
20
  */
21
21
  const SectionListWithEventThrottle = React.forwardRef(
22
+ // $FlowFixMe[incompatible-call]
22
23
  (
23
24
  props: React.ElementConfig<typeof SectionList>,
24
25
  ref:
@@ -27,7 +28,7 @@ const SectionListWithEventThrottle = React.forwardRef(
27
28
  current: null | SectionList<SectionBase<$FlowFixMe>>,
28
29
  ...
29
30
  },
30
- ) => <SectionList scrollEventThrottle={0.0001} {...props} ref={ref} />,
31
+ ) => <SectionList {...props} ref={ref} />,
31
32
  );
32
33
 
33
34
  export default (createAnimatedComponent(
@@ -37,6 +37,7 @@ export default function createAnimatedComponent<TProps: {...}, TInstance>(
37
37
  // $FlowFixMe[incompatible-call]
38
38
  props,
39
39
  );
40
+ // $FlowFixMe[incompatible-call]
40
41
  const ref = useMergeRefs<TInstance | null>(callbackRef, forwardedRef);
41
42
 
42
43
  // Some components require explicit passthrough values for animation
@@ -10,9 +10,9 @@
10
10
 
11
11
  'use strict';
12
12
 
13
- import type {NativeColorValue} from '../../StyleSheet/PlatformColorValueTypes';
14
13
  import type {ProcessedColorValue} from '../../StyleSheet/processColor';
15
14
  import type {ColorValue} from '../../StyleSheet/StyleSheet';
15
+ import type {NativeColorValue} from '../../StyleSheet/StyleSheetTypes';
16
16
  import type {PlatformConfig} from '../AnimatedPlatformConfig';
17
17
 
18
18
  import normalizeColor from '../../StyleSheet/normalizeColor';
@@ -0,0 +1,146 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow
8
+ * @format
9
+ * @oncall react_native
10
+ */
11
+
12
+ 'use strict';
13
+
14
+ import type {PlatformConfig} from '../AnimatedPlatformConfig';
15
+
16
+ import AnimatedNode from './AnimatedNode';
17
+ import AnimatedWithChildren from './AnimatedWithChildren';
18
+ import * as React from 'react';
19
+
20
+ const MAX_DEPTH = 5;
21
+
22
+ function isPlainObject(value: any): boolean {
23
+ return (
24
+ value !== null &&
25
+ typeof value === 'object' &&
26
+ Object.getPrototypeOf(value).isPrototypeOf(Object)
27
+ );
28
+ }
29
+
30
+ // Recurse through values, executing fn for any AnimatedNodes
31
+ function visit(value: any, fn: any => void, depth: number = 0): void {
32
+ if (depth >= MAX_DEPTH) {
33
+ return;
34
+ }
35
+
36
+ if (value instanceof AnimatedNode) {
37
+ fn(value);
38
+ } else if (Array.isArray(value)) {
39
+ value.forEach(element => {
40
+ visit(element, fn, depth + 1);
41
+ });
42
+ } else if (isPlainObject(value)) {
43
+ Object.values(value).forEach(element => {
44
+ visit(element, fn, depth + 1);
45
+ });
46
+ }
47
+ }
48
+
49
+ // Returns a copy of value with a transformation fn applied to any AnimatedNodes
50
+ function mapAnimatedNodes(value: any, fn: any => any, depth: number = 0): any {
51
+ if (depth >= MAX_DEPTH) {
52
+ return value;
53
+ }
54
+
55
+ if (value instanceof AnimatedNode) {
56
+ return fn(value);
57
+ } else if (Array.isArray(value)) {
58
+ return value.map(element => mapAnimatedNodes(element, fn, depth + 1));
59
+ } else if (isPlainObject(value)) {
60
+ const result: {[string]: any} = {};
61
+ for (const key in value) {
62
+ result[key] = mapAnimatedNodes(value[key], fn, depth + 1);
63
+ }
64
+ return result;
65
+ } else {
66
+ return value;
67
+ }
68
+ }
69
+
70
+ export function hasAnimatedNode(value: any, depth: number = 0): boolean {
71
+ if (depth >= MAX_DEPTH) {
72
+ return false;
73
+ }
74
+
75
+ if (value instanceof AnimatedNode) {
76
+ return true;
77
+ } else if (Array.isArray(value)) {
78
+ for (const element of value) {
79
+ if (hasAnimatedNode(element, depth + 1)) {
80
+ return true;
81
+ }
82
+ }
83
+ } else if (isPlainObject(value)) {
84
+ // Don't consider React elements
85
+ if (React.isValidElement(value)) {
86
+ return false;
87
+ }
88
+ for (const key in value) {
89
+ if (hasAnimatedNode(value[key], depth + 1)) {
90
+ return true;
91
+ }
92
+ }
93
+ }
94
+ return false;
95
+ }
96
+
97
+ export default class AnimatedObject extends AnimatedWithChildren {
98
+ _value: any;
99
+
100
+ constructor(value: any) {
101
+ super();
102
+ this._value = value;
103
+ }
104
+
105
+ __getValue(): any {
106
+ return mapAnimatedNodes(this._value, node => {
107
+ return node.__getValue();
108
+ });
109
+ }
110
+
111
+ __getAnimatedValue(): any {
112
+ return mapAnimatedNodes(this._value, node => {
113
+ return node.__getAnimatedValue();
114
+ });
115
+ }
116
+
117
+ __attach(): void {
118
+ super.__attach();
119
+ visit(this._value, node => {
120
+ node.__addChild(this);
121
+ });
122
+ }
123
+
124
+ __detach(): void {
125
+ visit(this._value, node => {
126
+ node.__removeChild(this);
127
+ });
128
+ super.__detach();
129
+ }
130
+
131
+ __makeNative(platformConfig: ?PlatformConfig): void {
132
+ visit(this._value, value => {
133
+ value.__makeNative(platformConfig);
134
+ });
135
+ super.__makeNative(platformConfig);
136
+ }
137
+
138
+ __getNativeConfig(): any {
139
+ return {
140
+ type: 'object',
141
+ value: mapAnimatedNodes(this._value, node => {
142
+ return {nodeTag: node.__getNativeTag()};
143
+ }),
144
+ };
145
+ }
146
+ }
@@ -16,9 +16,27 @@ import {findNodeHandle} from '../../ReactNative/RendererProxy';
16
16
  import {AnimatedEvent} from '../AnimatedEvent';
17
17
  import NativeAnimatedHelper from '../NativeAnimatedHelper';
18
18
  import AnimatedNode from './AnimatedNode';
19
+ import AnimatedObject, {hasAnimatedNode} from './AnimatedObject';
19
20
  import AnimatedStyle from './AnimatedStyle';
20
21
  import invariant from 'invariant';
21
22
 
23
+ function createAnimatedProps(inputProps: Object): Object {
24
+ const props: Object = {};
25
+ for (const key in inputProps) {
26
+ const value = inputProps[key];
27
+ if (key === 'style') {
28
+ props[key] = new AnimatedStyle(value);
29
+ } else if (value instanceof AnimatedNode) {
30
+ props[key] = value;
31
+ } else if (hasAnimatedNode(value)) {
32
+ props[key] = new AnimatedObject(value);
33
+ } else {
34
+ props[key] = value;
35
+ }
36
+ }
37
+ return props;
38
+ }
39
+
22
40
  export default class AnimatedProps extends AnimatedNode {
23
41
  _props: Object;
24
42
  _animatedView: any;
@@ -26,13 +44,7 @@ export default class AnimatedProps extends AnimatedNode {
26
44
 
27
45
  constructor(props: Object, callback: () => void) {
28
46
  super();
29
- if (props.style) {
30
- props = {
31
- ...props,
32
- style: new AnimatedStyle(props.style),
33
- };
34
- }
35
- this._props = props;
47
+ this._props = createAnimatedProps(props);
36
48
  this._callback = callback;
37
49
  }
38
50
 
@@ -12,99 +12,73 @@
12
12
 
13
13
  import type {PlatformConfig} from '../AnimatedPlatformConfig';
14
14
 
15
+ import ReactNativeFeatureFlags from '../../ReactNative/ReactNativeFeatureFlags';
15
16
  import flattenStyle from '../../StyleSheet/flattenStyle';
16
17
  import Platform from '../../Utilities/Platform';
17
18
  import NativeAnimatedHelper from '../NativeAnimatedHelper';
18
19
  import AnimatedNode from './AnimatedNode';
20
+ import AnimatedObject, {hasAnimatedNode} from './AnimatedObject';
19
21
  import AnimatedTransform from './AnimatedTransform';
20
22
  import AnimatedWithChildren from './AnimatedWithChildren';
21
23
 
22
- function createAnimatedStyle(inputStyle: any): Object {
24
+ function createAnimatedStyle(
25
+ inputStyle: any,
26
+ keepUnanimatedValues: boolean,
27
+ ): Object {
23
28
  // $FlowFixMe[underconstrained-implicit-instantiation]
24
29
  const style = flattenStyle(inputStyle);
25
30
  const animatedStyles: any = {};
26
31
  for (const key in style) {
27
32
  const value = style[key];
28
33
  if (key === 'transform') {
29
- animatedStyles[key] = new AnimatedTransform(value);
34
+ animatedStyles[key] =
35
+ ReactNativeFeatureFlags.shouldUseAnimatedObjectForTransform()
36
+ ? new AnimatedObject(value)
37
+ : new AnimatedTransform(value);
30
38
  } else if (value instanceof AnimatedNode) {
31
39
  animatedStyles[key] = value;
32
- } else if (value && !Array.isArray(value) && typeof value === 'object') {
33
- animatedStyles[key] = createAnimatedStyle(value);
40
+ } else if (hasAnimatedNode(value)) {
41
+ animatedStyles[key] = new AnimatedObject(value);
42
+ } else if (keepUnanimatedValues) {
43
+ animatedStyles[key] = value;
34
44
  }
35
45
  }
36
46
  return animatedStyles;
37
47
  }
38
48
 
39
- function createStyleWithAnimatedTransform(inputStyle: any): Object {
40
- // $FlowFixMe[underconstrained-implicit-instantiation]
41
- let style = flattenStyle(inputStyle) || ({}: {[string]: any});
42
-
43
- if (style.transform) {
44
- style = {
45
- ...style,
46
- transform: new AnimatedTransform(style.transform),
47
- };
48
- }
49
- return style;
50
- }
51
-
52
49
  export default class AnimatedStyle extends AnimatedWithChildren {
53
50
  _inputStyle: any;
54
51
  _style: Object;
55
52
 
56
53
  constructor(style: any) {
57
54
  super();
58
- if (Platform.OS === 'web') {
59
- this._inputStyle = style;
60
- this._style = createAnimatedStyle(style);
61
- } else {
62
- this._style = createStyleWithAnimatedTransform(style);
63
- }
55
+ this._inputStyle = style;
56
+ this._style = createAnimatedStyle(style, Platform.OS !== 'web');
64
57
  }
65
58
 
66
- // Recursively get values for nested styles (like iOS's shadowOffset)
67
- _walkStyleAndGetValues(style: any): {[string]: any | {...}} {
68
- const updatedStyle: {[string]: any | {...}} = {};
69
- for (const key in style) {
70
- const value = style[key];
59
+ __getValue(): Object | Array<Object> {
60
+ const result: {[string]: any} = {};
61
+ for (const key in this._style) {
62
+ const value = this._style[key];
71
63
  if (value instanceof AnimatedNode) {
72
- updatedStyle[key] = value.__getValue();
73
- } else if (value && !Array.isArray(value) && typeof value === 'object') {
74
- // Support animating nested values (for example: shadowOffset.height)
75
- updatedStyle[key] = this._walkStyleAndGetValues(value);
64
+ result[key] = value.__getValue();
76
65
  } else {
77
- updatedStyle[key] = value;
66
+ result[key] = value;
78
67
  }
79
68
  }
80
- return updatedStyle;
81
- }
82
69
 
83
- __getValue(): Object | Array<Object> {
84
- if (Platform.OS === 'web') {
85
- return [this._inputStyle, this._walkStyleAndGetValues(this._style)];
86
- }
87
-
88
- return this._walkStyleAndGetValues(this._style);
70
+ return Platform.OS === 'web' ? [this._inputStyle, result] : result;
89
71
  }
90
72
 
91
- // Recursively get animated values for nested styles (like iOS's shadowOffset)
92
- _walkStyleAndGetAnimatedValues(style: any): {[string]: any | {...}} {
93
- const updatedStyle: {[string]: any | {...}} = {};
94
- for (const key in style) {
95
- const value = style[key];
73
+ __getAnimatedValue(): Object {
74
+ const result: {[string]: any} = {};
75
+ for (const key in this._style) {
76
+ const value = this._style[key];
96
77
  if (value instanceof AnimatedNode) {
97
- updatedStyle[key] = value.__getAnimatedValue();
98
- } else if (value && !Array.isArray(value) && typeof value === 'object') {
99
- // Support animating nested values (for example: shadowOffset.height)
100
- updatedStyle[key] = this._walkStyleAndGetAnimatedValues(value);
78
+ result[key] = value.__getAnimatedValue();
101
79
  }
102
80
  }
103
- return updatedStyle;
104
- }
105
-
106
- __getAnimatedValue(): Object {
107
- return this._walkStyleAndGetAnimatedValues(this._style);
81
+ return result;
108
82
  }
109
83
 
110
84
  __attach(): void {
@@ -19,11 +19,7 @@ import invariant from 'invariant';
19
19
  export type AnimatedValueXYConfig = $ReadOnly<{
20
20
  useNativeDriver: boolean,
21
21
  }>;
22
- type ValueXYListenerCallback = (value: {
23
- x: number,
24
- y: number,
25
- ...
26
- }) => mixed;
22
+ type ValueXYListenerCallback = (value: {x: number, y: number, ...}) => mixed;
27
23
 
28
24
  let _uniqueId = 1;
29
25
 
@@ -135,11 +131,7 @@ export default class AnimatedValueXY extends AnimatedWithChildren {
135
131
  * See https://reactnative.dev/docs/animatedvaluexy#resetanimation
136
132
  */
137
133
  resetAnimation(
138
- callback?: (value: {
139
- x: number,
140
- y: number,
141
- ...
142
- }) => void,
134
+ callback?: (value: {x: number, y: number, ...}) => void,
143
135
  ): void {
144
136
  this.x.resetAnimation();
145
137
  this.y.resetAnimation();
@@ -153,13 +145,7 @@ export default class AnimatedValueXY extends AnimatedWithChildren {
153
145
  *
154
146
  * See https://reactnative.dev/docs/animatedvaluexy#stopanimation
155
147
  */
156
- stopAnimation(
157
- callback?: (value: {
158
- x: number,
159
- y: number,
160
- ...
161
- }) => void,
162
- ): void {
148
+ stopAnimation(callback?: (value: {x: number, y: number, ...}) => void): void {
163
149
  this.x.stopAnimation();
164
150
  this.y.stopAnimation();
165
151
  callback && callback(this.__getValue());
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow
8
+ * @format
9
+ */
10
+
11
+ import Platform from '../Utilities/Platform';
12
+
13
+ function shouldUseTurboAnimatedModule(): boolean {
14
+ return Platform.OS === 'ios' && global.RN$Bridgeless === true;
15
+ }
16
+
17
+ export default shouldUseTurboAnimatedModule;
@@ -10,7 +10,8 @@
10
10
 
11
11
  'use strict';
12
12
 
13
- import {isPublicInstance as isFabricPublicInstance} from '../Renderer/public/ReactFabricPublicInstanceUtils';
13
+ import {isPublicInstance as isFabricPublicInstance} from '../ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstanceUtils';
14
+ import ReactNativeFeatureFlags from '../ReactNative/ReactNativeFeatureFlags';
14
15
  import useRefEffect from '../Utilities/useRefEffect';
15
16
  import {AnimatedEvent} from './AnimatedEvent';
16
17
  import NativeAnimatedHelper from './NativeAnimatedHelper';
@@ -45,6 +46,8 @@ export default function useAnimatedProps<TProps: {...}, TInstance>(
45
46
  () => new AnimatedProps(props, () => onUpdateRef.current?.()),
46
47
  [props],
47
48
  );
49
+ const useNativePropsInFabric =
50
+ ReactNativeFeatureFlags.shouldUseSetNativePropsInFabric();
48
51
  useAnimatedPropsLifecycle(node);
49
52
 
50
53
  // TODO: This "effect" does three things:
@@ -66,13 +69,15 @@ export default function useAnimatedProps<TProps: {...}, TInstance>(
66
69
  // changes), but `setNativeView` already optimizes for that.
67
70
  node.setNativeView(instance);
68
71
 
69
- // NOTE: This callback is only used by the JavaScript animation driver.
72
+ // NOTE: When using the JS animation driver, this callback is called on
73
+ // every animation frame. When using the native driver, this callback is
74
+ // called when the animation completes.
70
75
  onUpdateRef.current = () => {
71
76
  if (
72
77
  process.env.NODE_ENV === 'test' ||
73
78
  typeof instance !== 'object' ||
74
79
  typeof instance?.setNativeProps !== 'function' ||
75
- isFabricInstance(instance)
80
+ (isFabricInstance(instance) && !useNativePropsInFabric)
76
81
  ) {
77
82
  // Schedule an update for this component to update `reducedProps`,
78
83
  // but do not compute it immediately. If a parent also updated, we
@@ -82,12 +87,6 @@ export default function useAnimatedProps<TProps: {...}, TInstance>(
82
87
  // $FlowIgnore[not-a-function] - Assume it's still a function.
83
88
  // $FlowFixMe[incompatible-use]
84
89
  instance.setNativeProps(node.__getAnimatedValue());
85
- } else {
86
- throw new Error(
87
- 'Attempting to run JS driven animation on animated node ' +
88
- 'that has been moved to "native" earlier by starting an ' +
89
- 'animation with `useNativeDriver: true`',
90
- );
91
90
  }
92
91
  };
93
92
 
@@ -110,7 +109,7 @@ export default function useAnimatedProps<TProps: {...}, TInstance>(
110
109
  }
111
110
  };
112
111
  },
113
- [props, node],
112
+ [props, node, useNativePropsInFabric],
114
113
  );
115
114
  const callbackRef = useRefEffect<TInstance>(refEffect);
116
115
 
@@ -24,7 +24,7 @@ import {NativeEventSubscription} from '../EventEmitter/RCTNativeAppEventEmitter'
24
24
  * App States
25
25
  * active - The app is running in the foreground
26
26
  * background - The app is running in the background. The user is either in another app or on the home screen
27
- * inactive [iOS] - This is a transition state that currently never happens for typical React Native apps.
27
+ * inactive [iOS] - This is a transition state that happens when the app launches, is asking for permissions or when a call or SMS message is received.
28
28
  * unknown [iOS] - Initial value until the current app state is determined
29
29
  * extension [iOS] - The app is running as an app extension
30
30
  *
@@ -12,12 +12,16 @@ import type {TurboModule} from '../TurboModule/RCTExport';
12
12
 
13
13
  import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry';
14
14
 
15
+ export type AppStateConstants = {|
16
+ initialAppState: string,
17
+ |};
18
+
19
+ export type AppState = {|app_state: string|};
20
+
15
21
  export interface Spec extends TurboModule {
16
- +getConstants: () => {|
17
- initialAppState: string,
18
- |};
22
+ +getConstants: () => AppStateConstants;
19
23
  +getCurrentAppState: (
20
- success: (appState: {|app_state: string|}) => void,
24
+ success: (appState: AppState) => void,
21
25
  error: (error: Object) => void,
22
26
  ) => void;
23
27