react-native-windows 0.79.4 → 0.80.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 (350) hide show
  1. package/.flowconfig +12 -3
  2. package/Directory.Build.props +5 -2
  3. package/Libraries/Alert/Alert.d.ts +4 -1
  4. package/Libraries/Alert/Alert.js +3 -0
  5. package/Libraries/Alert/Alert.windows.js +3 -0
  6. package/Libraries/Alert/RCTAlertManager.js +17 -0
  7. package/Libraries/Animated/Animated.js.flow +1 -3
  8. package/Libraries/Animated/AnimatedEvent.js +4 -3
  9. package/Libraries/Animated/AnimatedExports.js +2 -2
  10. package/Libraries/Animated/AnimatedExports.js.flow +140 -0
  11. package/Libraries/Animated/AnimatedImplementation.js +2 -123
  12. package/Libraries/Animated/Easing.js +13 -15
  13. package/Libraries/Animated/animations/Animation.js +8 -4
  14. package/Libraries/Animated/components/AnimatedFlatList.js +7 -6
  15. package/Libraries/Animated/components/AnimatedScrollView.js +48 -42
  16. package/Libraries/Animated/components/AnimatedSectionList.js +11 -7
  17. package/Libraries/Animated/createAnimatedComponent.js +105 -57
  18. package/Libraries/Animated/nodes/AnimatedNode.js +4 -3
  19. package/Libraries/Animated/nodes/AnimatedProps.js +46 -26
  20. package/Libraries/Animated/nodes/AnimatedValue.js +16 -7
  21. package/Libraries/Animated/nodes/AnimatedValueXY.js +3 -1
  22. package/Libraries/AppState/AppState.js +7 -2
  23. package/Libraries/BatchedBridge/MessageQueue.js +2 -2
  24. package/Libraries/BatchedBridge/NativeModules.js +2 -0
  25. package/Libraries/Blob/BlobManager.js +1 -0
  26. package/Libraries/Blob/FileReader.js +219 -8
  27. package/Libraries/Blob/URL.js +37 -12
  28. package/Libraries/Blob/URLSearchParams.js +106 -31
  29. package/Libraries/Blob/URLSearchParams.js.flow +12 -7
  30. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +1 -1
  31. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.windows.js +1 -1
  32. package/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent.js +17 -0
  33. package/Libraries/Components/ActivityIndicator/ActivityIndicator.js +1 -0
  34. package/Libraries/Components/Button.d.ts +3 -0
  35. package/Libraries/Components/Button.js +1 -1
  36. package/Libraries/Components/Button.windows.js +27 -1
  37. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +1 -3
  38. package/Libraries/{NewAppScreen/components/Colors.js → Components/DrawerAndroid/DrawerLayoutAndroid.ios.js} +6 -10
  39. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js +6 -66
  40. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js.flow +18 -0
  41. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidFallback.js +71 -0
  42. package/Libraries/Components/Flyout/Flyout.js +11 -0
  43. package/Libraries/Components/Keyboard/Keyboard.js +5 -3
  44. package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +6 -3
  45. package/Libraries/Components/Keyboard/KeyboardExt.js.map +1 -1
  46. package/Libraries/Components/Popup/Popup.js +11 -0
  47. package/Libraries/Components/Pressable/Pressable.js +20 -4
  48. package/Libraries/Components/Pressable/Pressable.windows.js +20 -4
  49. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.js +25 -3
  50. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroidTypes.js +29 -20
  51. package/Libraries/Components/RefreshControl/RefreshControl.js +1 -1
  52. package/Libraries/Components/RefreshControl/RefreshControl.windows.js +1 -1
  53. package/Libraries/Components/ScrollView/ScrollView.d.ts +3 -3
  54. package/Libraries/Components/ScrollView/ScrollView.js +132 -122
  55. package/Libraries/Components/ScrollView/ScrollView.windows.js +131 -122
  56. package/Libraries/Components/StaticRenderer.js +1 -1
  57. package/Libraries/Components/Switch/Switch.d.ts +3 -0
  58. package/Libraries/Components/Switch/Switch.js +8 -4
  59. package/Libraries/Components/Switch/Switch.windows.js +17 -4
  60. package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +2 -1
  61. package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +2 -4
  62. package/Libraries/Components/TextInput/TextInput.d.ts +70 -33
  63. package/Libraries/Components/TextInput/TextInput.flow.js +100 -51
  64. package/Libraries/Components/TextInput/TextInput.flow.windows.js +1246 -0
  65. package/Libraries/Components/TextInput/TextInput.js +88 -1027
  66. package/Libraries/Components/TextInput/TextInput.windows.js +104 -1092
  67. package/Libraries/Components/TextInput/TextInputState.js +1 -1
  68. package/Libraries/Components/TextInput/TextInputState.windows.js +1 -1
  69. package/Libraries/Components/TextInput/WindowsTextInputNativeComponent.js +2 -1
  70. package/Libraries/{Modal/ModalInjection.js → Components/ToastAndroid/ToastAndroid.ios.js} +3 -5
  71. package/Libraries/Components/ToastAndroid/ToastAndroid.js +4 -32
  72. package/Libraries/Components/ToastAndroid/ToastAndroid.js.flow +109 -0
  73. package/Libraries/Components/ToastAndroid/ToastAndroidFallback.js +45 -0
  74. package/Libraries/Components/Touchable/Touchable.js +5 -5
  75. package/Libraries/Components/Touchable/Touchable.windows.js +5 -5
  76. package/Libraries/Components/Touchable/TouchableBounce.js +14 -7
  77. package/Libraries/Components/Touchable/TouchableBounce.windows.js +14 -7
  78. package/Libraries/Components/Touchable/TouchableHighlight.js +10 -7
  79. package/Libraries/Components/Touchable/TouchableHighlight.windows.js +10 -7
  80. package/Libraries/Components/Touchable/TouchableNativeFeedback.js +6 -6
  81. package/Libraries/Components/Touchable/TouchableNativeFeedback.windows.js +6 -6
  82. package/Libraries/Components/Touchable/TouchableOpacity.js +13 -6
  83. package/Libraries/Components/Touchable/TouchableOpacity.windows.js +13 -6
  84. package/Libraries/Components/View/View.js +18 -21
  85. package/Libraries/Components/View/View.windows.js +39 -41
  86. package/Libraries/Components/View/ViewAccessibility.d.ts +8 -0
  87. package/Libraries/Components/View/ViewAccessibility.js +25 -1
  88. package/Libraries/Components/View/ViewAccessibility.windows.js +9 -1
  89. package/Libraries/Components/View/ViewPropTypes.js +49 -3
  90. package/Libraries/Components/View/ViewPropTypes.windows.js +50 -2
  91. package/Libraries/Core/ReactNativeVersion.js +1 -1
  92. package/Libraries/Core/setUpReactDevTools.js +5 -5
  93. package/Libraries/Debugging/DebuggingOverlayRegistry.js +3 -3
  94. package/Libraries/EventEmitter/NativeEventEmitter.js +9 -4
  95. package/Libraries/Image/AssetSourceResolver.js +17 -4
  96. package/Libraries/Image/AssetSourceResolver.windows.js +17 -4
  97. package/Libraries/Image/Image.d.ts +26 -10
  98. package/Libraries/Image/Image.js +17 -0
  99. package/Libraries/Image/Image.js.flow +5 -5
  100. package/Libraries/Image/Image.windows.js +13 -1
  101. package/Libraries/Image/ImageBackground.js +2 -0
  102. package/Libraries/Image/ImageInjection.js +1 -1
  103. package/Libraries/Image/ImageProps.js +22 -17
  104. package/Libraries/Image/ImageSource.js +3 -1
  105. package/Libraries/Image/ImageSourceUtils.js +4 -2
  106. package/Libraries/Image/ImageTypes.flow.js +1 -1
  107. package/Libraries/Interaction/InteractionManager.d.ts +13 -0
  108. package/Libraries/Interaction/InteractionManager.js +1 -1
  109. package/Libraries/Interaction/PanResponder.js +3 -3
  110. package/Libraries/Interaction/TaskQueue.js +1 -0
  111. package/Libraries/LayoutAnimation/LayoutAnimation.js +2 -2
  112. package/Libraries/Linking/Linking.js +1 -1
  113. package/Libraries/Lists/FlatList.d.ts +2 -2
  114. package/Libraries/Lists/FlatList.js +8 -11
  115. package/Libraries/Lists/SectionList.js +39 -42
  116. package/Libraries/Lists/SectionListModern.js +25 -34
  117. package/Libraries/Lists/VirtualizedList.js +1 -0
  118. package/Libraries/Lists/VirtualizedSectionList.js +1 -0
  119. package/Libraries/LogBox/Data/LogBoxData.js +1 -1
  120. package/Libraries/LogBox/LogBoxNotificationContainer.js +1 -1
  121. package/Libraries/Modal/Modal.js +33 -7
  122. package/Libraries/Modal/Modal.windows.js +33 -10
  123. package/Libraries/NativeComponent/BaseViewConfig.android.js +2 -0
  124. package/Libraries/NativeComponent/BaseViewConfig.ios.js +2 -0
  125. package/Libraries/NativeComponent/BaseViewConfig.js +17 -0
  126. package/Libraries/NativeComponent/BaseViewConfig.windows.js +3 -0
  127. package/Libraries/NativeComponent/PlatformBaseViewConfig.js +2 -2
  128. package/Libraries/NativeModules/specs/NativeDevMenu.js +2 -2
  129. package/Libraries/Network/RCTNetworking.android.js +1 -1
  130. package/Libraries/Network/RCTNetworking.ios.js +1 -1
  131. package/Libraries/Network/RCTNetworking.js +17 -0
  132. package/Libraries/Network/RCTNetworking.js.flow +1 -1
  133. package/Libraries/Network/RCTNetworking.windows.js +1 -1
  134. package/Libraries/Network/XMLHttpRequest.js +781 -10
  135. package/Libraries/Performance/Systrace.js +7 -7
  136. package/Libraries/Pressability/Pressability.js +1 -1
  137. package/Libraries/Pressability/Pressability.windows.js +1 -1
  138. package/Libraries/ReactNative/AppContainer-dev.js +5 -4
  139. package/Libraries/ReactNative/AppRegistry.flow.js +49 -0
  140. package/Libraries/ReactNative/AppRegistry.js +2 -322
  141. package/Libraries/ReactNative/AppRegistry.js.flow +23 -0
  142. package/Libraries/ReactNative/AppRegistryImpl.js +316 -0
  143. package/Libraries/ReactNative/FabricUIManager.js +10 -0
  144. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +2 -4
  145. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +1 -4
  146. package/Libraries/ReactNative/RendererImplementation.js +10 -5
  147. package/Libraries/ReactNative/getNativeComponentAttributes.js +1 -0
  148. package/Libraries/ReactNative/renderApplication.js +9 -0
  149. package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +3 -3
  150. package/Libraries/ReactPrivate/ReactNativePrivateInterface.js.flow +51 -0
  151. package/Libraries/Renderer/implementations/ReactFabric-dev.js +4840 -4748
  152. package/Libraries/Renderer/implementations/ReactFabric-prod.js +4947 -4829
  153. package/Libraries/Renderer/implementations/ReactFabric-profiling.js +3998 -3888
  154. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +5005 -4948
  155. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +2744 -2652
  156. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +5020 -4933
  157. package/Libraries/Renderer/shims/ReactNativeTypes.js +3 -3
  158. package/Libraries/Settings/Settings.ios.js +1 -0
  159. package/Libraries/Settings/Settings.js +13 -19
  160. package/Libraries/Settings/SettingsFallback.js +33 -0
  161. package/Libraries/StyleSheet/PlatformColorValueTypes.js +15 -0
  162. package/Libraries/StyleSheet/PlatformColorValueTypesIOS.js +6 -0
  163. package/Libraries/StyleSheet/Rect.js +1 -0
  164. package/Libraries/StyleSheet/StyleSheet.js +31 -200
  165. package/Libraries/StyleSheet/StyleSheet.js.flow +188 -0
  166. package/Libraries/StyleSheet/StyleSheetExports.js +210 -0
  167. package/Libraries/StyleSheet/StyleSheetExports.js.flow +112 -0
  168. package/Libraries/StyleSheet/StyleSheetTypes.d.ts +1 -1
  169. package/Libraries/StyleSheet/StyleSheetTypes.js +130 -52
  170. package/Libraries/StyleSheet/flattenStyle.js +14 -4
  171. package/Libraries/StyleSheet/private/_TransformStyle.js +49 -21
  172. package/Libraries/StyleSheet/processBackgroundImage.js +670 -214
  173. package/Libraries/Text/Text.d.ts +2 -5
  174. package/Libraries/Text/Text.js +3 -3
  175. package/Libraries/Text/Text.windows.js +3 -3
  176. package/Libraries/Text/TextNativeComponent.js +0 -4
  177. package/Libraries/Text/TextProps.js +5 -33
  178. package/Libraries/Text/TextProps.windows.js +5 -32
  179. package/Libraries/Types/CodegenTypesNamespace.d.ts +45 -0
  180. package/Libraries/{Blob/__mocks__/BlobModule.js → Types/CodegenTypesNamespace.js} +4 -6
  181. package/Libraries/Types/CoreEventTypes.d.ts +6 -1
  182. package/Libraries/Types/CoreEventTypes.js +1 -1
  183. package/Libraries/Types/CoreEventTypes.windows.js +1 -1
  184. package/Libraries/Utilities/Appearance.js +2 -0
  185. package/Libraries/Utilities/BackHandler.js +17 -0
  186. package/Libraries/Utilities/DeviceInfo.js +2 -0
  187. package/Libraries/Utilities/Dimensions.js +1 -1
  188. package/Libraries/Utilities/Platform.js +17 -0
  189. package/Libraries/Utilities/PlatformTypes.js +11 -3
  190. package/Libraries/Utilities/ReactNativeTestTools.js +2 -2
  191. package/Libraries/Utilities/codegenNativeCommands.d.ts +18 -0
  192. package/Libraries/Utilities/codegenNativeComponent.d.ts +26 -0
  193. package/Libraries/WebSocket/WebSocket.js +313 -8
  194. package/Libraries/vendor/core/ErrorUtils.js +28 -2
  195. package/Libraries/vendor/emitter/EventEmitter.js +6 -2
  196. package/Microsoft.ReactNative/CompositionSwitcher.idl +8 -0
  197. package/Microsoft.ReactNative/Fabric/AbiComponentDescriptor.cpp +0 -6
  198. package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper.cpp +197 -1
  199. package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +34 -4
  200. package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +12 -0
  201. package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.cpp +36 -33
  202. package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp +81 -0
  203. package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.h +5 -0
  204. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +148 -14
  205. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.h +4 -0
  206. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputEventEmitter.cpp +29 -0
  207. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputEventEmitter.h +2 -0
  208. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.cpp +17 -34
  209. package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +9 -3
  210. package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.h +2 -0
  211. package/Microsoft.ReactNative/Fabric/ImageManager.cpp +1 -1
  212. package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewEventEmitter.cpp +16 -0
  213. package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewEventEmitter.h +1 -0
  214. package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewProps.cpp +9 -0
  215. package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewProps.h +1 -0
  216. package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewTraitsInitializer.h +4 -0
  217. package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/WindowsTextLayoutManager.cpp +36 -96
  218. package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/WindowsTextLayoutManager.h +1 -1
  219. package/Microsoft.ReactNative/Modules/SampleTurboModule.cpp +4 -0
  220. package/Microsoft.ReactNative/Modules/SampleTurboModule.h +3 -0
  221. package/Microsoft.ReactNative/TurboModulesProvider.h +1 -1
  222. package/Microsoft.ReactNative.Cxx/JSI/JsiApiContext.h +1 -1
  223. package/Microsoft.ReactNative.Cxx/JSI/LongLivedJsiValue.h +1 -1
  224. package/PropertySheets/Generated/PackageVersion.g.props +4 -4
  225. package/PropertySheets/React.Cpp.props +4 -0
  226. package/README.md +2 -2
  227. package/ReactCommon/ReactCommon.vcxproj +9 -4
  228. package/ReactCommon/ReactCommon.vcxproj.filters +6 -0
  229. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/CxxNativeModule.cpp +253 -0
  230. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/JSExecutor.cpp +5 -2
  231. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/NativeToJsBridge.cpp +4 -8
  232. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/TraceSection.h +184 -0
  233. package/ReactCommon/TEMP_UntilReactCommonUpdate/jsinspector-modern/NetworkIOAgent.cpp +22 -0
  234. package/ReactCommon/TEMP_UntilReactCommonUpdate/jsinspector-modern/NetworkIOAgent.h +2 -4
  235. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/core/ReactCommon/TurboModuleWithJSIBindings.cpp +27 -0
  236. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/componentregistry/ComponentDescriptorRegistry.cpp +3 -2
  237. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/AccessibilityPrimitives.h +1 -1
  238. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/AccessibilityProps.cpp +308 -0
  239. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/DynamicEventPayload.cpp +42 -0
  240. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/css/CSSTokenizer.h +7 -51
  241. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/runtime/ReactInstance.cpp +10 -5
  242. package/Scripts/creaternwapp.cmd +9 -3
  243. package/Shared/Shared.vcxitems +3 -2
  244. package/Shared/Shared.vcxitems.filters +2 -1
  245. package/codegen/NativeAnimatedModuleSpec.g.h +2 -0
  246. package/codegen/NativeAnimatedTurboModuleSpec.g.h +2 -0
  247. package/codegen/NativePerformanceSpec.g.h +14 -0
  248. package/codegen/NativeReactNativeFeatureFlagsSpec.g.h +151 -127
  249. package/codegen/NativeSampleTurboModuleSpec.g.h +14 -8
  250. package/codegen/react/components/rnwcore/EventEmitters.cpp +48 -48
  251. package/codegen/rnwcoreJSI-generated.cpp +159 -129
  252. package/codegen/rnwcoreJSI.h +534 -408
  253. package/index.js +51 -331
  254. package/index.windows.js +70 -352
  255. package/interface.js +0 -4
  256. package/jest/resolver.js +31 -0
  257. package/jest/setup.js +6 -2
  258. package/package.json +29 -28
  259. package/src/private/animated/NativeAnimatedHelper.js +21 -8
  260. package/src/private/animated/createAnimatedPropsHook.js +11 -16
  261. package/src/private/animated/createAnimatedPropsMemoHook.js +1 -2
  262. package/src/private/components/{SafeAreaView_INTERNAL_DO_NOT_USE.js → safeareaview/SafeAreaView_INTERNAL_DO_NOT_USE.js} +6 -6
  263. package/src/private/components/{HScrollViewNativeComponents.js → scrollview/HScrollViewNativeComponents.js} +8 -8
  264. package/src/private/components/scrollview/VScrollViewNativeComponents.js +25 -0
  265. package/src/private/{devmenu → devsupport/devmenu}/DevMenu.js +1 -1
  266. package/src/private/{inspector → devsupport/devmenu/elementinspector}/BorderBox.js +3 -3
  267. package/src/private/{inspector → devsupport/devmenu/elementinspector}/BoxInspector.js +6 -5
  268. package/src/private/{inspector → devsupport/devmenu/elementinspector}/ElementBox.js +8 -6
  269. package/src/private/{inspector → devsupport/devmenu/elementinspector}/ElementProperties.js +11 -10
  270. package/src/private/{inspector → devsupport/devmenu/elementinspector}/Inspector.js +14 -12
  271. package/src/private/{inspector → devsupport/devmenu/elementinspector}/InspectorOverlay.js +5 -4
  272. package/src/private/{inspector → devsupport/devmenu/elementinspector}/InspectorPanel.js +9 -8
  273. package/src/private/{inspector → devsupport/devmenu/elementinspector}/NetworkOverlay.js +10 -9
  274. package/src/private/{inspector → devsupport/devmenu/elementinspector}/ReactDevToolsOverlay.js +7 -7
  275. package/src/private/{inspector → devsupport/devmenu/elementinspector}/StyleInspector.js +7 -6
  276. package/src/private/{inspector → devsupport/devmenu/elementinspector}/XHRInterceptor.js +2 -2
  277. package/src/private/{inspector → devsupport/devmenu/elementinspector}/getInspectorDataForViewAtPoint.js +4 -4
  278. package/src/private/{inspector → devsupport/devmenu/elementinspector}/resolveBoxStyle.js +1 -1
  279. package/src/private/{inspector → devsupport/devmenu/perfmonitor}/PerformanceOverlay.js +6 -5
  280. package/src/private/{specs_DEPRECATED/modules → devsupport/devmenu/specs}/NativeDevMenu.js +2 -2
  281. package/src/private/{debugging → devsupport/rndevtools}/ReactDevToolsSettingsManager.android.js +1 -1
  282. package/src/private/{debugging → devsupport/rndevtools}/ReactDevToolsSettingsManager.ios.js +1 -1
  283. package/src/private/{debugging → devsupport/rndevtools}/ReactDevToolsSettingsManager.windows.js +1 -1
  284. package/src/private/{debugging → devsupport/rndevtools}/setUpFuseboxReactDevToolsDispatcher.js +1 -1
  285. package/src/private/{fusebox → devsupport/rndevtools}/specs/NativeReactDevToolsRuntimeSettingsModule.js +2 -2
  286. package/src/private/{specs_DEPRECATED/modules → devsupport/rndevtools/specs}/NativeReactDevToolsSettingsManager.js +2 -2
  287. package/src/private/featureflags/ReactNativeFeatureFlags.js +82 -80
  288. package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +12 -1
  289. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +17 -13
  290. package/src/private/renderer/errorhandling/ErrorHandlers.js +2 -2
  291. package/src/private/specs_DEPRECATED/modules/NativeAnimatedModule.js +1 -1
  292. package/src/private/specs_DEPRECATED/modules/NativeAnimatedTurboModule.js +1 -1
  293. package/src/private/specs_DEPRECATED/modules/NativeSampleTurboModule.js +3 -0
  294. package/src/private/styles/composeStyles.js +12 -5
  295. package/src/private/types/HostComponent.js +1 -1
  296. package/src/private/types/HostInstance.js +67 -1
  297. package/src/private/webapis/dom/nodes/ReactNativeElement.js +2 -5
  298. package/src/private/webapis/dom/nodes/ReadOnlyNode.js +5 -18
  299. package/src/private/webapis/dom/nodes/internals/NodeInternals.js +6 -0
  300. package/src/private/webapis/performance/Performance.js +1 -3
  301. package/src/private/webapis/performance/PerformanceEntry.js +6 -1
  302. package/src/private/webapis/performance/internals/RawPerformanceEntry.js +3 -0
  303. package/src/private/webapis/performance/specs/NativePerformance.js +10 -1
  304. package/src/types/globals.d.ts +42 -0
  305. package/stubs/double-conversion/double-conversion.h +3 -1
  306. package/templates/cpp-app/windows/MyApp/MyApp.vcxproj +4 -0
  307. package/templates/cpp-lib/windows/MyLib/MyLib.vcxproj +4 -0
  308. package/types/index.d.ts +6 -3
  309. package/types/public/ReactNativeTypes.d.ts +2 -2
  310. package/Libraries/BatchedBridge/__mocks__/MessageQueueTestConfig.js +0 -38
  311. package/Libraries/BatchedBridge/__mocks__/MessageQueueTestModule.js +0 -22
  312. package/Libraries/Blob/FileReader_new.js +0 -231
  313. package/Libraries/Blob/FileReader_old.js +0 -186
  314. package/Libraries/Blob/__mocks__/FileReaderModule.js +0 -20
  315. package/Libraries/Components/RefreshControl/__mocks__/RefreshControlMock.js +0 -32
  316. package/Libraries/Core/__mocks__/ErrorUtils.js +0 -33
  317. package/Libraries/Core/__mocks__/NativeExceptionsManager.js +0 -19
  318. package/Libraries/EventEmitter/__mocks__/NativeEventEmitter.js +0 -49
  319. package/Libraries/Events/CustomEvent.js +0 -32
  320. package/Libraries/Events/EventPolyfill.js +0 -239
  321. package/Libraries/Lists/__flowtests__/FlatList-flowtest.js +0 -118
  322. package/Libraries/Lists/__flowtests__/SectionList-flowtest.js +0 -134
  323. package/Libraries/Network/XMLHttpRequest_new.js +0 -794
  324. package/Libraries/Network/XMLHttpRequest_old.js +0 -701
  325. package/Libraries/NewAppScreen/components/DebugInstructions.js +0 -41
  326. package/Libraries/NewAppScreen/components/DebugInstructions.windows.js +0 -30
  327. package/Libraries/NewAppScreen/components/Header.js +0 -77
  328. package/Libraries/NewAppScreen/components/HermesBadge.js +0 -53
  329. package/Libraries/NewAppScreen/components/LearnMoreLinks.js +0 -148
  330. package/Libraries/NewAppScreen/components/ReloadInstructions.js +0 -39
  331. package/Libraries/NewAppScreen/components/ReloadInstructions.windows.js +0 -31
  332. package/Libraries/NewAppScreen/components/logo.png +0 -0
  333. package/Libraries/NewAppScreen/index.js +0 -25
  334. package/Libraries/StyleSheet/__flowtests__/StyleSheet-flowtest.js +0 -58
  335. package/Libraries/Utilities/__mocks__/BackHandler.js +0 -45
  336. package/Libraries/Utilities/__mocks__/GlobalPerformanceLogger.js +0 -16
  337. package/Libraries/Utilities/__mocks__/PixelRatio.js +0 -25
  338. package/Libraries/WebSocket/WebSocketEvent.js +0 -30
  339. package/Libraries/WebSocket/WebSocket_new.js +0 -325
  340. package/Libraries/WebSocket/WebSocket_old.js +0 -297
  341. package/Libraries/WebSocket/__mocks__/event-target-shim.js +0 -27
  342. package/Libraries/__flowtests__/ReactNativeTypes-flowtest.js +0 -30
  343. package/Libraries/vendor/emitter/__flowtests__/EventEmitter-flowtest.js +0 -81
  344. package/jest/__tests__/setup-test.js +0 -18
  345. package/src/private/components/VScrollViewNativeComponents.js +0 -25
  346. package/src/private/utilities/ensureInstance.js +0 -21
  347. package/src/private/webapis/performance/specs/__mocks__/NativePerformanceMock.js +0 -267
  348. package/types/modules/LaunchScreen.d.ts +0 -18
  349. /package/src/private/{devmenu → devsupport/devmenu}/DevMenu.d.ts +0 -0
  350. /package/src/private/{debugging → devsupport/rndevtools}/FuseboxSessionObserver.js +0 -0
@@ -23,48 +23,51 @@ import useAnimatedProps from '../useAnimatedProps';
23
23
  import * as React from 'react';
24
24
  import {useMemo} from 'react';
25
25
 
26
- type Props = React.ElementConfig<typeof ScrollView>;
27
- type Instance = React.ElementRef<typeof ScrollView>;
26
+ type AnimatedScrollViewProps = React.ElementConfig<typeof ScrollView>;
27
+ type AnimatedScrollViewInstance = React.ElementRef<typeof ScrollView>;
28
28
 
29
29
  /**
30
30
  * @see https://github.com/facebook/react-native/commit/b8c8562
31
31
  */
32
- const AnimatedScrollView: AnimatedComponentType<Props, Instance> =
33
- React.forwardRef(
34
- function AnimatedScrollViewWithOrWithoutInvertedRefreshControl(
35
- props,
36
- forwardedRef,
32
+ const AnimatedScrollView: AnimatedComponentType<
33
+ AnimatedScrollViewProps,
34
+ AnimatedScrollViewInstance,
35
+ > = React.forwardRef(
36
+ function AnimatedScrollViewWithOrWithoutInvertedRefreshControl(
37
+ props,
38
+ forwardedRef,
39
+ ) {
40
+ // (Android only) When a ScrollView has a RefreshControl and
41
+ // any `style` property set with an Animated.Value, the CSS
42
+ // gets incorrectly applied twice. This is because ScrollView
43
+ // swaps the parent/child relationship of itself and the
44
+ // RefreshControl component (see ScrollView.js for more details).
45
+ if (
46
+ Platform.OS === 'android' &&
47
+ props.refreshControl != null &&
48
+ props.style != null
37
49
  ) {
38
- // (Android only) When a ScrollView has a RefreshControl and
39
- // any `style` property set with an Animated.Value, the CSS
40
- // gets incorrectly applied twice. This is because ScrollView
41
- // swaps the parent/child relationship of itself and the
42
- // RefreshControl component (see ScrollView.js for more details).
43
- if (
44
- Platform.OS === 'android' &&
45
- props.refreshControl != null &&
46
- props.style != null
47
- ) {
48
- return (
49
- // $FlowFixMe[prop-missing]
50
- <AnimatedScrollViewWithInvertedRefreshControl
51
- scrollEventThrottle={0.0001}
52
- {...props}
53
- ref={forwardedRef}
54
- refreshControl={props.refreshControl}
55
- />
56
- );
57
- } else {
58
- return (
59
- <AnimatedScrollViewWithoutInvertedRefreshControl
60
- scrollEventThrottle={0.0001}
61
- {...props}
62
- ref={forwardedRef}
63
- />
64
- );
65
- }
66
- },
67
- );
50
+ return (
51
+ // $FlowFixMe - It should return an Animated ScrollView but it returns a ScrollView with Animated props applied.
52
+ <AnimatedScrollViewWithInvertedRefreshControl
53
+ scrollEventThrottle={0.0001}
54
+ {...props}
55
+ ref={forwardedRef}
56
+ // $FlowFixMe[incompatible-type]
57
+ refreshControl={props.refreshControl}
58
+ />
59
+ );
60
+ } else {
61
+ return (
62
+ <AnimatedScrollViewWithoutInvertedRefreshControl
63
+ scrollEventThrottle={0.0001}
64
+ {...props}
65
+ ref={forwardedRef}
66
+ />
67
+ );
68
+ }
69
+ },
70
+ );
68
71
 
69
72
  const AnimatedScrollViewWithInvertedRefreshControl = React.forwardRef(
70
73
  // $FlowFixMe[incompatible-call]
@@ -75,8 +78,8 @@ const AnimatedScrollViewWithInvertedRefreshControl = React.forwardRef(
75
78
  refreshControl: ExactReactElement_DEPRECATED<any>,
76
79
  },
77
80
  forwardedRef:
78
- | {current: Instance | null, ...}
79
- | ((Instance | null) => mixed),
81
+ | {current: AnimatedScrollViewInstance | null, ...}
82
+ | ((AnimatedScrollViewInstance | null) => mixed),
80
83
  ) {
81
84
  // Split `props` into the animate-able props for the parent (RefreshControl)
82
85
  // and child (ScrollView).
@@ -106,10 +109,13 @@ const AnimatedScrollViewWithInvertedRefreshControl = React.forwardRef(
106
109
 
107
110
  // Handle animated props on `NativeDirectionalScrollView`.
108
111
  const [scrollViewAnimatedProps, scrollViewRef] = useAnimatedProps<
109
- Props,
110
- Instance,
112
+ AnimatedScrollViewProps,
113
+ AnimatedScrollViewInstance,
111
114
  >(intermediatePropsForScrollView);
112
- const ref = useMergeRefs<Instance>(scrollViewRef, forwardedRef);
115
+ const ref = useMergeRefs<AnimatedScrollViewInstance>(
116
+ scrollViewRef,
117
+ forwardedRef,
118
+ );
113
119
 
114
120
  return (
115
121
  // $FlowFixMe[incompatible-use] Investigate useAnimatedProps return value
@@ -8,15 +8,19 @@
8
8
  * @format
9
9
  */
10
10
 
11
- import type {SectionBase} from '../../Lists/SectionList';
12
- import type {AnimatedComponentType} from '../createAnimatedComponent';
11
+ import type {AnimatedProps} from '../createAnimatedComponent';
13
12
 
14
- import SectionList from '../../Lists/SectionList';
13
+ import SectionList, {type SectionListProps} from '../../Lists/SectionList';
15
14
  import createAnimatedComponent from '../createAnimatedComponent';
16
15
  import * as React from 'react';
17
16
 
18
- export default (createAnimatedComponent(SectionList): AnimatedComponentType<
19
- React.ElementConfig<typeof SectionList>,
17
+ // $FlowFixMe
18
+ export default (createAnimatedComponent(SectionList): component<
20
19
  // $FlowExpectedError[unclear-type]
21
- SectionList<SectionBase<any>>,
22
- >);
20
+ ItemT = any,
21
+ // $FlowExpectedError[unclear-type]
22
+ SectionT = any,
23
+ >(
24
+ ref?: React.RefSetter<SectionList<ItemT, SectionT>>,
25
+ ...props: AnimatedProps<SectionListProps<ItemT, SectionT>>
26
+ ));
@@ -8,7 +8,16 @@
8
8
  * @format
9
9
  */
10
10
 
11
+ import type AnimatedAddition from './nodes/AnimatedAddition';
12
+ import type AnimatedDiffClamp from './nodes/AnimatedDiffClamp';
13
+ import type AnimatedDivision from './nodes/AnimatedDivision';
14
+ import type AnimatedInterpolation from './nodes/AnimatedInterpolation';
15
+ import type AnimatedModulo from './nodes/AnimatedModulo';
16
+ import type AnimatedMultiplication from './nodes/AnimatedMultiplication';
17
+ import type AnimatedNode from './nodes/AnimatedNode';
11
18
  import type {AnimatedPropsAllowlist} from './nodes/AnimatedProps';
19
+ import type AnimatedSubtraction from './nodes/AnimatedSubtraction';
20
+ import type AnimatedValue from './nodes/AnimatedValue';
12
21
 
13
22
  import createAnimatedPropsHook from '../../src/private/animated/createAnimatedPropsHook';
14
23
  import composeStyles from '../../src/private/styles/composeStyles';
@@ -17,81 +26,120 @@ import useMergeRefs from '../Utilities/useMergeRefs';
17
26
  import * as React from 'react';
18
27
  import {useMemo} from 'react';
19
28
 
20
- export type AnimatedProps<Props: {...}> = {
21
- // eslint-disable-next-line no-unused-vars
22
- +[_K in keyof (Props &
23
- $ReadOnly<{
24
- passthroughAnimatedPropExplicitValues?: React.ElementConfig<
25
- typeof View,
26
- >,
27
- }>)]: any,
28
- };
29
+ type Nullable = void | null;
30
+ type Primitive = string | number | boolean | symbol | void;
31
+ type Builtin = (...$ReadOnlyArray<empty>) => mixed | Date | Error | RegExp;
32
+
33
+ export type WithAnimatedValue<+T> = T extends Builtin | Nullable
34
+ ? T
35
+ : T extends Primitive
36
+ ?
37
+ | T
38
+ | AnimatedNode
39
+ | AnimatedAddition
40
+ | AnimatedSubtraction
41
+ | AnimatedDivision
42
+ | AnimatedMultiplication
43
+ | AnimatedModulo
44
+ | AnimatedDiffClamp
45
+ | AnimatedValue
46
+ | AnimatedInterpolation<number | string>
47
+ | AnimatedInterpolation<number>
48
+ | AnimatedInterpolation<string>
49
+ : T extends $ReadOnlyArray<infer P>
50
+ ? $ReadOnlyArray<WithAnimatedValue<P>>
51
+ : T extends {...}
52
+ ? {+[K in keyof T]: WithAnimatedValue<T[K]>}
53
+ : T;
29
54
 
30
- // We could use a mapped type here to introduce acceptable Animated variants
31
- // of properties, instead of doing so in the core StyleSheetTypes
32
- // Inexact Props are not supported, they'll be made exact here.
33
- export type StrictAnimatedProps<Props: {...}> = $ReadOnly<{
34
- ...$Exact<Props>,
35
- passthroughAnimatedPropExplicitValues?: ?Props,
55
+ type NonAnimatedProps =
56
+ | 'ref'
57
+ | 'innerViewRef'
58
+ | 'scrollViewRef'
59
+ | 'testID'
60
+ | 'disabled'
61
+ | 'accessibilityLabel';
62
+ type PassThroughProps = $ReadOnly<{
63
+ passthroughAnimatedPropExplicitValues?: React.ElementConfig<
64
+ typeof View,
65
+ > | null,
36
66
  }>;
37
67
 
68
+ export type AnimatedProps<Props: {...}> = {
69
+ [K in keyof Props]: K extends NonAnimatedProps
70
+ ? Props[K]
71
+ : WithAnimatedValue<Props[K]>,
72
+ } & PassThroughProps;
73
+
74
+ export type AnimatedBaseProps<Props: {...}> = {
75
+ [K in keyof Props]: K extends NonAnimatedProps
76
+ ? Props[K]
77
+ : WithAnimatedValue<Props[K]>,
78
+ };
79
+
38
80
  export type AnimatedComponentType<Props: {...}, +Instance = mixed> = component(
39
- ref: React.RefSetter<Instance>,
81
+ ref?: React.RefSetter<Instance>,
40
82
  ...AnimatedProps<Props>
41
83
  );
42
84
 
43
- export type StrictAnimatedComponentType<
44
- Props: {...},
45
- +Instance = mixed,
46
- > = component(ref: React.RefSetter<Instance>, ...StrictAnimatedProps<Props>);
47
-
48
- export default function createAnimatedComponent<TProps: {...}, TInstance>(
49
- Component: component(ref: React.RefSetter<TInstance>, ...TProps),
50
- ): AnimatedComponentType<TProps, TInstance> {
85
+ export default function createAnimatedComponent<
86
+ TInstance: React.ComponentType<any>,
87
+ >(
88
+ Component: TInstance,
89
+ ): AnimatedComponentType<
90
+ $ReadOnly<React.ElementProps<TInstance>>,
91
+ React.ElementRef<TInstance>,
92
+ > {
51
93
  return unstable_createAnimatedComponentWithAllowlist(Component, null);
52
94
  }
53
95
 
54
96
  export function unstable_createAnimatedComponentWithAllowlist<
55
97
  TProps: {...},
56
- TInstance,
98
+ TInstance: React.ComponentType<TProps>,
57
99
  >(
58
- Component: component(ref: React.RefSetter<TInstance>, ...TProps),
100
+ Component: TInstance,
59
101
  allowlist: ?AnimatedPropsAllowlist,
60
- ): StrictAnimatedComponentType<TProps, TInstance> {
102
+ ): AnimatedComponentType<TProps, React.ElementRef<TInstance>> {
61
103
  const useAnimatedProps = createAnimatedPropsHook(allowlist);
62
104
 
63
- const AnimatedComponent = React.forwardRef<
64
- StrictAnimatedProps<TProps>,
65
- TInstance,
66
- >((props, forwardedRef) => {
67
- const [reducedProps, callbackRef] = useAnimatedProps<TProps, TInstance>(
68
- props,
69
- );
70
- const ref = useMergeRefs<TInstance>(callbackRef, forwardedRef);
105
+ const AnimatedComponent: AnimatedComponentType<
106
+ TProps,
107
+ React.ElementRef<TInstance>,
108
+ > = React.forwardRef<AnimatedProps<TProps>, React.ElementRef<TInstance>>(
109
+ (props, forwardedRef) => {
110
+ const [reducedProps, callbackRef] = useAnimatedProps<
111
+ TProps,
112
+ React.ElementRef<TInstance>,
113
+ >(props);
114
+ const ref = useMergeRefs<React.ElementRef<TInstance>>(
115
+ callbackRef,
116
+ forwardedRef,
117
+ );
71
118
 
72
- // Some components require explicit passthrough values for animation
73
- // to work properly. For example, if an animated component is
74
- // transformed and Pressable, onPress will not work after transform
75
- // without these passthrough values.
76
- // $FlowFixMe[prop-missing]
77
- const {passthroughAnimatedPropExplicitValues, style} = reducedProps;
78
- const passthroughStyle = passthroughAnimatedPropExplicitValues?.style;
79
- const mergedStyle = useMemo(
80
- () => composeStyles(style, passthroughStyle),
81
- [passthroughStyle, style],
82
- );
119
+ // Some components require explicit passthrough values for animation
120
+ // to work properly. For example, if an animated component is
121
+ // transformed and Pressable, onPress will not work after transform
122
+ // without these passthrough values.
123
+ // $FlowFixMe[prop-missing]
124
+ const {passthroughAnimatedPropExplicitValues, style} = reducedProps;
125
+ const passthroughStyle = passthroughAnimatedPropExplicitValues?.style;
126
+ const mergedStyle = useMemo(
127
+ () => composeStyles(style, passthroughStyle),
128
+ [passthroughStyle, style],
129
+ );
83
130
 
84
- // NOTE: It is important that `passthroughAnimatedPropExplicitValues` is
85
- // spread after `reducedProps` but before `style`.
86
- return (
87
- <Component
88
- {...reducedProps}
89
- {...passthroughAnimatedPropExplicitValues}
90
- style={mergedStyle}
91
- ref={ref}
92
- />
93
- );
94
- });
131
+ // NOTE: It is important that `passthroughAnimatedPropExplicitValues` is
132
+ // spread after `reducedProps` but before `style`.
133
+ return (
134
+ <Component
135
+ {...reducedProps}
136
+ {...passthroughAnimatedPropExplicitValues}
137
+ style={mergedStyle}
138
+ ref={ref}
139
+ />
140
+ );
141
+ },
142
+ );
95
143
 
96
144
  AnimatedComponent.displayName = `Animated(${
97
145
  Component.displayName || 'Anonymous'
@@ -28,7 +28,7 @@ let _assertNativeAnimatedModule: ?() => void = () => {
28
28
  };
29
29
 
30
30
  export default class AnimatedNode {
31
- #listeners: Map<string, ValueListenerCallback> = new Map();
31
+ #listeners: Map<string, ValueListenerCallback>;
32
32
 
33
33
  _platformConfig: ?PlatformConfig = undefined;
34
34
 
@@ -38,6 +38,7 @@ export default class AnimatedNode {
38
38
  ...
39
39
  }>,
40
40
  ) {
41
+ this.#listeners = new Map();
41
42
  if (__DEV__) {
42
43
  this.__debugID = config?.debugID;
43
44
  }
@@ -111,8 +112,8 @@ export default class AnimatedNode {
111
112
  return this.#listeners.size > 0;
112
113
  }
113
114
 
114
- __onAnimatedValueUpdateReceived(value: number): void {
115
- this.__callListeners(value);
115
+ __onAnimatedValueUpdateReceived(value: number, offset: number): void {
116
+ this.__callListeners(value + offset);
116
117
  }
117
118
 
118
119
  __callListeners(value: number): void {
@@ -22,9 +22,15 @@ import invariant from 'invariant';
22
22
 
23
23
  export type AnimatedPropsAllowlist = $ReadOnly<{
24
24
  style?: ?AnimatedStyleAllowlist,
25
- [string]: true,
25
+ [key: string]: true | AnimatedStyleAllowlist,
26
26
  }>;
27
27
 
28
+ type TargetView = {
29
+ +instance: TargetViewInstance,
30
+ connectedViewTag: ?number,
31
+ };
32
+ type TargetViewInstance = React.ElementRef<React.ElementType>;
33
+
28
34
  function createAnimatedProps(
29
35
  inputProps: {[string]: mixed},
30
36
  allowlist: ?AnimatedPropsAllowlist,
@@ -75,11 +81,11 @@ function createAnimatedProps(
75
81
  }
76
82
 
77
83
  export default class AnimatedProps extends AnimatedNode {
78
- #animatedView: any = null;
79
84
  #callback: () => void;
80
85
  #nodeKeys: $ReadOnlyArray<string>;
81
86
  #nodes: $ReadOnlyArray<AnimatedNode>;
82
87
  #props: {[string]: mixed};
88
+ #target: ?TargetView = null;
83
89
 
84
90
  constructor(
85
91
  inputProps: {[string]: mixed},
@@ -140,6 +146,22 @@ export default class AnimatedProps extends AnimatedNode {
140
146
  return props;
141
147
  }
142
148
 
149
+ __getNativeAnimatedEventTuples(): $ReadOnlyArray<[string, AnimatedEvent]> {
150
+ const tuples = [];
151
+
152
+ const keys = Object.keys(this.#props);
153
+ for (let ii = 0, length = keys.length; ii < length; ii++) {
154
+ const key = keys[ii];
155
+ const value = this.#props[key];
156
+
157
+ if (value instanceof AnimatedEvent && value.__isNative) {
158
+ tuples.push([key, value]);
159
+ }
160
+ }
161
+
162
+ return tuples;
163
+ }
164
+
143
165
  __getAnimatedValue(): Object {
144
166
  const props: {[string]: mixed} = {};
145
167
 
@@ -164,10 +186,10 @@ export default class AnimatedProps extends AnimatedNode {
164
186
  }
165
187
 
166
188
  __detach(): void {
167
- if (this.__isNative && this.#animatedView) {
168
- this.__disconnectAnimatedView();
189
+ if (this.__isNative && this.#target != null) {
190
+ this.#disconnectAnimatedView(this.#target);
169
191
  }
170
- this.#animatedView = null;
192
+ this.#target = null;
171
193
 
172
194
  const nodes = this.#nodes;
173
195
  for (let ii = 0, length = nodes.length; ii < length; ii++) {
@@ -193,56 +215,54 @@ export default class AnimatedProps extends AnimatedNode {
193
215
  this.__isNative = true;
194
216
 
195
217
  // Since this does not call the super.__makeNative, we need to store the
196
- // supplied platformConfig here, before calling __connectAnimatedView
218
+ // supplied platformConfig here, before calling #connectAnimatedView
197
219
  // where it will be needed to traverse the graph of attached values.
198
220
  super.__setPlatformConfig(platformConfig);
199
221
 
200
- if (this.#animatedView) {
201
- this.__connectAnimatedView();
222
+ if (this.#target != null) {
223
+ this.#connectAnimatedView(this.#target);
202
224
  }
203
225
  }
204
226
  }
205
227
 
206
- setNativeView(animatedView: any): void {
207
- if (this.#animatedView === animatedView) {
228
+ setNativeView(instance: TargetViewInstance): void {
229
+ if (this.#target?.instance === instance) {
208
230
  return;
209
231
  }
210
- this.#animatedView = animatedView;
232
+ this.#target = {instance, connectedViewTag: null};
211
233
  if (this.__isNative) {
212
- this.__connectAnimatedView();
234
+ this.#connectAnimatedView(this.#target);
213
235
  }
214
236
  }
215
237
 
216
- __connectAnimatedView(): void {
238
+ #connectAnimatedView(target: TargetView): void {
217
239
  invariant(this.__isNative, 'Expected node to be marked as "native"');
218
- let nativeViewTag: ?number = findNodeHandle(this.#animatedView);
219
- if (nativeViewTag == null) {
240
+ let viewTag: ?number = findNodeHandle(target.instance);
241
+ if (viewTag == null) {
220
242
  if (process.env.NODE_ENV === 'test') {
221
- nativeViewTag = -1;
243
+ viewTag = -1;
222
244
  } else {
223
245
  throw new Error('Unable to locate attached view in the native tree');
224
246
  }
225
247
  }
226
248
  NativeAnimatedHelper.API.connectAnimatedNodeToView(
227
249
  this.__getNativeTag(),
228
- nativeViewTag,
250
+ viewTag,
229
251
  );
252
+ target.connectedViewTag = viewTag;
230
253
  }
231
254
 
232
- __disconnectAnimatedView(): void {
255
+ #disconnectAnimatedView(target: TargetView): void {
233
256
  invariant(this.__isNative, 'Expected node to be marked as "native"');
234
- let nativeViewTag: ?number = findNodeHandle(this.#animatedView);
235
- if (nativeViewTag == null) {
236
- if (process.env.NODE_ENV === 'test') {
237
- nativeViewTag = -1;
238
- } else {
239
- throw new Error('Unable to locate attached view in the native tree');
240
- }
257
+ const viewTag = target.connectedViewTag;
258
+ if (viewTag == null) {
259
+ return;
241
260
  }
242
261
  NativeAnimatedHelper.API.disconnectAnimatedNodeFromView(
243
262
  this.__getNativeTag(),
244
- nativeViewTag,
263
+ viewTag,
245
264
  );
265
+ target.connectedViewTag = null;
246
266
  }
247
267
 
248
268
  __restoreDefaultValues(): void {
@@ -10,7 +10,8 @@
10
10
 
11
11
  import type {EventSubscription} from '../../vendor/emitter/EventEmitter';
12
12
  import type {PlatformConfig} from '../AnimatedPlatformConfig';
13
- import type Animation, {EndCallback} from '../animations/Animation';
13
+ import type Animation from '../animations/Animation';
14
+ import type {EndCallback} from '../animations/Animation';
14
15
  import type {InterpolationConfigType} from './AnimatedInterpolation';
15
16
  import type AnimatedNode from './AnimatedNode';
16
17
  import type {AnimatedNodeConfig} from './AnimatedNode';
@@ -51,7 +52,6 @@ const NativeAnimatedAPI = NativeAnimatedHelper.API;
51
52
  * transform which can receive values from multiple parents.
52
53
  */
53
54
  export function flushValue(rootNode: AnimatedNode): void {
54
- // eslint-disable-next-line func-call-spacing
55
55
  const leaves = new Set<{update: () => void, ...}>();
56
56
  function findAnimatedStyles(node: AnimatedNode) {
57
57
  // $FlowFixMe[prop-missing]
@@ -85,8 +85,8 @@ function _executeAsAnimatedBatch(id: string, operation: () => void) {
85
85
  * See https://reactnative.dev/docs/animatedvalue
86
86
  */
87
87
  export default class AnimatedValue extends AnimatedWithChildren {
88
- #listenerCount: number = 0;
89
- #updateSubscription: ?EventSubscription = null;
88
+ #listenerCount: number;
89
+ #updateSubscription: ?EventSubscription;
90
90
 
91
91
  _value: number;
92
92
  _startingValue: number;
@@ -99,6 +99,10 @@ export default class AnimatedValue extends AnimatedWithChildren {
99
99
  if (typeof value !== 'number') {
100
100
  throw new Error('AnimatedValue: Attempting to set value to undefined');
101
101
  }
102
+
103
+ this.#listenerCount = 0;
104
+ this.#updateSubscription = null;
105
+
102
106
  this._startingValue = this._value = value;
103
107
  this._offset = 0;
104
108
  this._animation = null;
@@ -164,7 +168,7 @@ export default class AnimatedValue extends AnimatedWithChildren {
164
168
  'onAnimatedValueUpdate',
165
169
  data => {
166
170
  if (data.tag === nativeTag) {
167
- this.__onAnimatedValueUpdateReceived(data.value);
171
+ this.__onAnimatedValueUpdateReceived(data.value, data.offset);
168
172
  }
169
173
  },
170
174
  );
@@ -242,7 +246,9 @@ export default class AnimatedValue extends AnimatedWithChildren {
242
246
  this._offset += this._value;
243
247
  this._value = 0;
244
248
  if (this.__isNative) {
245
- NativeAnimatedAPI.extractAnimatedNodeOffset(this.__getNativeTag());
249
+ _executeAsAnimatedBatch(this.__getNativeTag().toString(), () =>
250
+ NativeAnimatedAPI.extractAnimatedNodeOffset(this.__getNativeTag()),
251
+ );
246
252
  }
247
253
  }
248
254
 
@@ -282,8 +288,11 @@ export default class AnimatedValue extends AnimatedWithChildren {
282
288
  }
283
289
  }
284
290
 
285
- __onAnimatedValueUpdateReceived(value: number): void {
291
+ __onAnimatedValueUpdateReceived(value: number, offset?: number): void {
286
292
  this._updateValue(value, false /*flush*/);
293
+ if (offset != null) {
294
+ this._offset = offset;
295
+ }
287
296
  }
288
297
 
289
298
  /**
@@ -214,7 +214,9 @@ export default class AnimatedValueXY extends AnimatedWithChildren {
214
214
  *
215
215
  * See https://reactnative.dev/docs/animatedvaluexy#gettranslatetransform
216
216
  */
217
- getTranslateTransform(): Array<{[key: string]: AnimatedValue, ...}> {
217
+ getTranslateTransform(): Array<
218
+ {translateX: AnimatedValue} | {translateY: AnimatedValue},
219
+ > {
218
220
  return [{translateX: this.x}, {translateY: this.y}];
219
221
  }
220
222
 
@@ -22,7 +22,12 @@ import NativeAppState from './NativeAppState';
22
22
  * - @platform android - on another Activity (even if it was launched by your app)
23
23
  * @platform ios - inactive - This is a state that occurs when transitioning between foreground & background, and during periods of inactivity such as entering the multitasking view, opening the Notification Center or in the event of an incoming call.
24
24
  */
25
- export type AppStateStatus = 'inactive' | 'background' | 'active';
25
+ export type AppStateStatus =
26
+ | 'inactive'
27
+ | 'background'
28
+ | 'active'
29
+ | 'extension'
30
+ | 'unknown';
26
31
 
27
32
  /**
28
33
  * change - This even is received when the app state has changed.
@@ -107,7 +112,7 @@ class AppStateImpl {
107
112
  */
108
113
  addEventListener<K: AppStateEvent>(
109
114
  type: K,
110
- handler: (...$ElementType<AppStateEventDefinitions, K>) => void,
115
+ handler: (...AppStateEventDefinitions[K]) => void,
111
116
  ): EventSubscription {
112
117
  const emitter = this._emitter;
113
118
  if (emitter == null) {
@@ -35,7 +35,7 @@ const PARAMS = 2;
35
35
  const MIN_TIME_BETWEEN_FLUSHES_MS = 5;
36
36
 
37
37
  // eslint-disable-next-line no-bitwise
38
- const TRACE_TAG_REACT_APPS = 1 << 17;
38
+ const TRACE_TAG_REACT = 1 << 13;
39
39
 
40
40
  const DEBUG_INFO_LIMIT = 32;
41
41
 
@@ -228,7 +228,7 @@ class MessageQueue {
228
228
  if (__DEV__) {
229
229
  global.nativeTraceBeginAsyncFlow &&
230
230
  global.nativeTraceBeginAsyncFlow(
231
- TRACE_TAG_REACT_APPS,
231
+ TRACE_TAG_REACT,
232
232
  'native',
233
233
  this._callID,
234
234
  );
@@ -65,6 +65,7 @@ function genModule(
65
65
  module[methodName] = genMethod(moduleID, methodID, methodType);
66
66
  });
67
67
 
68
+ // $FlowFixMe[unsafe-object-assign]
68
69
  Object.assign(module, constants);
69
70
 
70
71
  if (module.getConstants == null) {
@@ -173,6 +174,7 @@ function updateErrorWithErrorData(
173
174
  /* $FlowFixMe[class-object-subtyping] added when improving typing for this
174
175
  * parameters */
175
176
  // $FlowFixMe[incompatible-return]
177
+ // $FlowFixMe[unsafe-object-assign]
176
178
  return Object.assign(error, errorData || {});
177
179
  }
178
180
 
@@ -110,6 +110,7 @@ class BlobManager {
110
110
  static createFromOptions(options: BlobData): Blob {
111
111
  BlobRegistry.register(options.blobId);
112
112
  // $FlowFixMe[prop-missing]
113
+ // $FlowFixMe[unsafe-object-assign]
113
114
  return Object.assign(Object.create(Blob.prototype), {
114
115
  data:
115
116
  // Reuse the collector instance when creating from an existing blob.