react-native-tvos 0.86.2-0 → 0.87.0-0

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 (1148) hide show
  1. package/Libraries/ActionSheetIOS/ActionSheetIOS.js +19 -24
  2. package/Libraries/ActionSheetIOS/React-RCTActionSheet.podspec +1 -1
  3. package/Libraries/Alert/Alert.js +38 -1
  4. package/Libraries/Animated/AnimatedExports.js +22 -0
  5. package/Libraries/Animated/AnimatedExports.js.flow +1 -1
  6. package/Libraries/Animated/AnimatedImplementation.js +120 -3
  7. package/Libraries/Animated/Easing.js +4 -3
  8. package/Libraries/Animated/NativeAnimatedAllowlist.js +37 -0
  9. package/Libraries/Animated/animations/Animation.js +14 -5
  10. package/Libraries/Animated/animations/DecayAnimation.js +1 -0
  11. package/Libraries/Animated/animations/SpringAnimation.js +1 -0
  12. package/Libraries/Animated/animations/TimingAnimation.js +9 -0
  13. package/Libraries/Animated/components/AnimatedScrollView.js +1 -1
  14. package/Libraries/Animated/createAnimatedComponent.js +3 -3
  15. package/Libraries/Animated/nodes/AnimatedColor.js +8 -8
  16. package/Libraries/Animated/nodes/AnimatedInterpolation.js +106 -0
  17. package/Libraries/Animated/nodes/AnimatedProps.js +27 -3
  18. package/Libraries/Animated/nodes/AnimatedValue.js +8 -0
  19. package/Libraries/Animated/nodes/AnimatedValueXY.js +2 -2
  20. package/Libraries/AppDelegate/RCTAppDelegate.h +5 -9
  21. package/Libraries/AppDelegate/RCTAppDelegate.mm +0 -20
  22. package/Libraries/AppDelegate/RCTAppSetupUtils.h +0 -18
  23. package/Libraries/AppDelegate/RCTAppSetupUtils.mm +0 -78
  24. package/Libraries/AppDelegate/RCTDefaultReactNativeFactoryDelegate.mm +18 -17
  25. package/Libraries/AppDelegate/RCTReactNativeFactory.h +5 -41
  26. package/Libraries/AppDelegate/RCTReactNativeFactory.mm +0 -82
  27. package/Libraries/AppDelegate/RCTRootViewFactory.h +4 -1
  28. package/Libraries/AppDelegate/RCTRootViewFactory.mm +3 -98
  29. package/Libraries/AppDelegate/React-RCTAppDelegate.podspec +2 -1
  30. package/Libraries/AppState/AppState.d.ts +4 -1
  31. package/Libraries/AppState/AppState.js +32 -17
  32. package/Libraries/BatchedBridge/MessageQueue.js +42 -51
  33. package/Libraries/BatchedBridge/NativeModules.js +7 -0
  34. package/Libraries/Blob/Blob.js +7 -1
  35. package/Libraries/Blob/FileReader.js +6 -0
  36. package/Libraries/Blob/React-RCTBlob.podspec +1 -1
  37. package/Libraries/Blob/URLSearchParams.js.flow +1 -1
  38. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.d.ts +20 -9
  39. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +30 -43
  40. package/Libraries/Components/ActivityIndicator/ActivityIndicator.js +59 -49
  41. package/Libraries/Components/ActivityIndicator/ActivityIndicatorViewNativeComponent.js +2 -2
  42. package/Libraries/Components/Button.js +96 -182
  43. package/Libraries/Components/Clipboard/Clipboard.js +5 -0
  44. package/Libraries/Components/DrawerAndroid/AndroidDrawerLayoutNativeComponent.js +2 -2
  45. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +8 -69
  46. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.d.ts +10 -1
  47. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.ios.js +2 -0
  48. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidTypes.js +26 -31
  49. package/Libraries/Components/Keyboard/Keyboard.js +23 -60
  50. package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +15 -7
  51. package/Libraries/Components/Pressable/Pressable.js +39 -17
  52. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js +5 -6
  53. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.js +4 -4
  54. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroidNativeComponent.js +2 -2
  55. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroidTypes.js +17 -0
  56. package/Libraries/Components/RefreshControl/AndroidSwipeRefreshLayoutNativeComponent.js +2 -2
  57. package/Libraries/Components/RefreshControl/PullToRefreshViewNativeComponent.js +2 -2
  58. package/Libraries/Components/RefreshControl/RefreshControl.js +40 -50
  59. package/Libraries/Components/SafeAreaView/RCTSafeAreaViewNativeComponent.js +2 -2
  60. package/Libraries/Components/SafeAreaView/SafeAreaView.js +8 -8
  61. package/Libraries/Components/ScrollView/AndroidHorizontalScrollContentViewNativeComponent.js +2 -2
  62. package/Libraries/Components/ScrollView/ScrollView.d.ts +55 -43
  63. package/Libraries/Components/ScrollView/ScrollView.js +202 -115
  64. package/Libraries/Components/ScrollView/ScrollViewCommands.js +4 -4
  65. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +1 -1
  66. package/Libraries/Components/StatusBar/StatusBar.d.ts +7 -54
  67. package/Libraries/Components/StatusBar/StatusBar.js +85 -161
  68. package/Libraries/Components/Switch/AndroidSwitchNativeComponent.js +2 -2
  69. package/Libraries/Components/Switch/Switch.js +76 -75
  70. package/Libraries/Components/Switch/SwitchNativeComponent.js +2 -2
  71. package/Libraries/Components/TV/TVEventHandler.js +16 -1
  72. package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +1 -1
  73. package/Libraries/Components/TextInput/InputAccessoryView.js +13 -61
  74. package/Libraries/Components/TextInput/RCTInputAccessoryViewNativeComponent.js +2 -2
  75. package/Libraries/Components/TextInput/TextInput.d.ts +9 -2
  76. package/Libraries/Components/TextInput/TextInput.flow.js +20 -3
  77. package/Libraries/Components/TextInput/TextInput.js +116 -111
  78. package/Libraries/Components/TextInput/TextInputNativeCommands.js +3 -3
  79. package/Libraries/Components/ToastAndroid/ToastAndroid.android.js +25 -19
  80. package/Libraries/Components/Touchable/Touchable.d.ts +1 -1
  81. package/Libraries/Components/Touchable/Touchable.js +94 -95
  82. package/Libraries/Components/Touchable/TouchableHighlight.js +46 -114
  83. package/Libraries/Components/Touchable/TouchableNativeFeedback.js +13 -25
  84. package/Libraries/Components/Touchable/TouchableOpacity.js +14 -84
  85. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +4 -3
  86. package/Libraries/Components/UnimplementedViews/UnimplementedNativeViewNativeComponent.js +2 -2
  87. package/Libraries/Components/View/ReactNativeStyleAttributes.js +1 -0
  88. package/Libraries/Components/View/View.js +85 -64
  89. package/Libraries/Components/View/ViewAccessibility.d.ts +12 -2
  90. package/Libraries/Components/View/ViewAccessibility.js +17 -6
  91. package/Libraries/Components/View/ViewNativeComponent.js +6 -8
  92. package/Libraries/Components/View/ViewPropTypes.js +55 -9
  93. package/Libraries/Core/InitializeCore.js +9 -1
  94. package/Libraries/Core/ReactFiberErrorDialog.js +3 -3
  95. package/Libraries/Core/ReactNativeVersion.js +2 -2
  96. package/Libraries/Core/Timers/JSTimers.js +53 -52
  97. package/Libraries/Core/setUpGlobals.js +9 -4
  98. package/Libraries/Core/setUpNavigator.js +7 -2
  99. package/Libraries/Core/setUpReactDevTools.js +0 -118
  100. package/Libraries/Core/setUpXHR.js +6 -2
  101. package/Libraries/Debugging/DebuggingOverlay.js +2 -2
  102. package/Libraries/Debugging/DebuggingOverlayNativeComponent.js +2 -2
  103. package/Libraries/EventEmitter/NativeEventEmitter.js +29 -0
  104. package/Libraries/EventEmitter/RCTDeviceEventEmitter.js +7 -7
  105. package/Libraries/EventEmitter/RCTNativeAppEventEmitter.d.ts +1 -1
  106. package/Libraries/EventEmitter/RCTNativeAppEventEmitter.js +3 -0
  107. package/Libraries/FBLazyVector/FBLazyVector.podspec +1 -1
  108. package/Libraries/Image/AssetSourceResolver.js +18 -27
  109. package/Libraries/Image/Image.android.js +13 -2
  110. package/Libraries/Image/Image.ios.js +3 -1
  111. package/Libraries/Image/ImageBackground.js +30 -18
  112. package/Libraries/Image/ImageProps.js +116 -117
  113. package/Libraries/Image/ImageSource.d.ts +1 -1
  114. package/Libraries/Image/ImageSource.js +9 -9
  115. package/Libraries/Image/ImageSourceUtils.js +10 -7
  116. package/Libraries/Image/ImageTypes.flow.js +2 -0
  117. package/Libraries/Image/ImageViewNativeComponent.js +1 -1
  118. package/Libraries/Image/RCTImageLoader.mm +61 -64
  119. package/Libraries/Image/RCTImageStoreManager.h +0 -2
  120. package/Libraries/Image/React-RCTImage.podspec +1 -1
  121. package/Libraries/Image/RelativeImageStub.js +1 -1
  122. package/Libraries/Image/resolveAssetSource.js +1 -1
  123. package/Libraries/Interaction/PanResponder.js +102 -97
  124. package/Libraries/LayoutAnimation/LayoutAnimation.js +22 -6
  125. package/Libraries/Linking/Linking.js +24 -23
  126. package/Libraries/LinkingIOS/React-RCTLinking.podspec +1 -1
  127. package/Libraries/Lists/FlatList.d.ts +6 -17
  128. package/Libraries/Lists/FlatList.js +7 -8
  129. package/Libraries/Lists/SectionList.js +7 -0
  130. package/Libraries/Lists/VirtualizedList.js +3 -0
  131. package/Libraries/Lists/VirtualizedSectionList.js +4 -0
  132. package/Libraries/LogBox/LogBox.js +3 -3
  133. package/Libraries/LogBox/UI/AnsiHighlight.js +2 -1
  134. package/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js +2 -2
  135. package/Libraries/LogBox/UI/LogBoxInspectorFooter.js +4 -1
  136. package/Libraries/LogBox/UI/LogBoxInspectorFooterButton.js +3 -1
  137. package/Libraries/LogBox/UI/LogBoxInspectorHeader.js +8 -2
  138. package/Libraries/LogBox/UI/LogBoxInspectorMessageHeader.js +9 -2
  139. package/Libraries/LogBox/UI/LogBoxInspectorReactFrames.js +17 -4
  140. package/Libraries/LogBox/UI/LogBoxInspectorSection.js +3 -1
  141. package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js +3 -1
  142. package/Libraries/LogBox/UI/LogBoxInspectorStackFrame.js +2 -0
  143. package/Libraries/LogBox/UI/LogBoxInspectorStackFrames.js +4 -2
  144. package/Libraries/LogBox/UI/LogBoxMessage.js +18 -5
  145. package/Libraries/LogBox/UI/LogBoxNotificationCountBadge.js +4 -1
  146. package/Libraries/LogBox/UI/LogBoxNotificationMessage.js +1 -0
  147. package/Libraries/LogBox/UI/LogBoxStyle.js +0 -4
  148. package/Libraries/Modal/Modal.d.ts +5 -4
  149. package/Libraries/Modal/Modal.js +71 -37
  150. package/Libraries/Modal/RCTModalHostViewNativeComponent.js +2 -2
  151. package/Libraries/NativeAnimation/React-RCTAnimation.podspec +1 -1
  152. package/Libraries/NativeComponent/BaseViewConfig.android.js +17 -0
  153. package/Libraries/NativeComponent/ViewConfig.js +3 -3
  154. package/Libraries/NativeComponent/ViewConfigIgnore.js +1 -1
  155. package/Libraries/Network/RCTHTTPRequestHandler.h +1 -1
  156. package/Libraries/Network/React-RCTNetwork.podspec +1 -1
  157. package/Libraries/Performance/Systrace.js +36 -0
  158. package/Libraries/PermissionsAndroid/PermissionsAndroid.d.ts +4 -2
  159. package/Libraries/PermissionsAndroid/PermissionsAndroid.js +29 -17
  160. package/Libraries/Pressability/Pressability.js +1 -1
  161. package/Libraries/PushNotificationIOS/PushNotificationIOS.js +4 -0
  162. package/Libraries/PushNotificationIOS/React-RCTPushNotification.podspec +1 -1
  163. package/Libraries/ReactNative/AppContainer-dev.js +3 -1
  164. package/Libraries/ReactNative/AppRegistry.flow.js +1 -0
  165. package/Libraries/ReactNative/AppRegistry.js +15 -11
  166. package/Libraries/ReactNative/AppRegistryImpl.js +57 -11
  167. package/Libraries/ReactNative/DisplayMode.js +1 -1
  168. package/Libraries/ReactNative/FabricUIManager.js +29 -26
  169. package/Libraries/ReactNative/I18nManager.js +20 -0
  170. package/Libraries/ReactNative/UIManager.js +53 -0
  171. package/Libraries/ReactNative/renderApplication.js +1 -1
  172. package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +5 -126
  173. package/Libraries/ReactPrivate/ReactNativePrivateInterface.js.flow +5 -41
  174. package/Libraries/Renderer/README.md +2 -2
  175. package/Libraries/Renderer/shims/ReactNativeTypes.js +36 -36
  176. package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +4 -4
  177. package/Libraries/Required/RCTRequired.podspec +1 -1
  178. package/Libraries/Settings/React-RCTSettings.podspec +1 -1
  179. package/Libraries/Settings/Settings.ios.js +22 -0
  180. package/Libraries/Share/Share.js +25 -28
  181. package/Libraries/StyleSheet/PlatformColorValueTypes.js.flow +6 -0
  182. package/Libraries/StyleSheet/StyleSheet.js +42 -2
  183. package/Libraries/StyleSheet/StyleSheet.js.flow +1 -1
  184. package/Libraries/StyleSheet/StyleSheetExports.js +7 -5
  185. package/Libraries/StyleSheet/StyleSheetExports.js.flow +1 -1
  186. package/Libraries/StyleSheet/StyleSheetTypes.d.ts +24 -3
  187. package/Libraries/StyleSheet/StyleSheetTypes.js +34 -6
  188. package/Libraries/StyleSheet/flattenStyle.js +28 -13
  189. package/Libraries/StyleSheet/private/_TransformStyle.js +16 -14
  190. package/Libraries/Text/React-RCTText.podspec +1 -1
  191. package/Libraries/Text/Text.js +12 -9
  192. package/Libraries/Text/TextEffectNativeComponent.js +31 -0
  193. package/Libraries/Text/TextInput/Multiline/RCTUITextView.mm +0 -1
  194. package/Libraries/Text/TextInput/RCTBackedTextInputViewProtocol.h +0 -1
  195. package/Libraries/Text/TextInput/Singleline/RCTUITextField.mm +0 -1
  196. package/Libraries/Text/TextProps.js +59 -93
  197. package/Libraries/Text/requireNativeTextEffect.js +28 -0
  198. package/Libraries/TurboModule/RCTExport.js +1 -1
  199. package/Libraries/TypeSafety/RCTTypeSafety.podspec +1 -1
  200. package/Libraries/Types/CoreEventTypes.d.ts +8 -0
  201. package/Libraries/Types/CoreEventTypes.js +32 -29
  202. package/Libraries/Types/UIManagerJSInterface.js +2 -2
  203. package/Libraries/Utilities/Appearance.d.ts +32 -17
  204. package/Libraries/Utilities/Appearance.js +35 -18
  205. package/Libraries/Utilities/BackHandler.android.js +13 -33
  206. package/Libraries/Utilities/BackHandler.js.flow +18 -2
  207. package/Libraries/Utilities/DevSettings.js +8 -1
  208. package/Libraries/Utilities/Dimensions.js +18 -12
  209. package/Libraries/Utilities/PixelRatio.js +5 -2
  210. package/Libraries/Utilities/Platform.js.flow +4 -0
  211. package/Libraries/Utilities/PlatformTypes.js +77 -0
  212. package/Libraries/Utilities/PolyfillFunctions.js +1 -1
  213. package/Libraries/Utilities/differ/deepDiffer.js +5 -2
  214. package/Libraries/Utilities/useColorScheme.js +11 -1
  215. package/Libraries/Utilities/useWindowDimensions.js +6 -0
  216. package/Libraries/Vibration/React-RCTVibration.podspec +1 -1
  217. package/Libraries/Vibration/Vibration.js +14 -11
  218. package/Libraries/vendor/emitter/EventEmitter.js +3 -3
  219. package/README-core.md +6 -6
  220. package/React/Base/RCTBridge+Private.h +0 -22
  221. package/React/Base/RCTBridge.h +10 -8
  222. package/React/Base/RCTBridge.mm +5 -447
  223. package/React/Base/RCTBridgeDelegate.h +1 -56
  224. package/React/Base/RCTBridgeModule.h +0 -9
  225. package/React/Base/RCTBridgeProxy.h +8 -0
  226. package/React/Base/RCTBridgeProxy.mm +3 -20
  227. package/React/Base/RCTBundleManager.h +0 -3
  228. package/React/Base/RCTBundleManager.m +0 -31
  229. package/React/Base/RCTBundleURLProvider.mm +4 -4
  230. package/React/Base/RCTCallableJSModules.m +0 -18
  231. package/React/Base/RCTConstants.h +1 -0
  232. package/React/Base/RCTConstants.m +1 -0
  233. package/React/Base/RCTConvert.mm +3 -0
  234. package/React/Base/RCTDisplayLink.h +3 -1
  235. package/React/Base/RCTJavaScriptExecutor.h +0 -69
  236. package/React/Base/RCTModuleData.mm +2 -483
  237. package/React/Base/RCTModuleRegistry.m +0 -25
  238. package/React/Base/RCTRootView.h +0 -11
  239. package/React/Base/RCTRootView.m +3 -461
  240. package/React/Base/RCTUtils.h +0 -3
  241. package/React/Base/RCTUtils.mm +17 -27
  242. package/React/Base/RCTVersion.m +2 -2
  243. package/React/Base/RCTViewRegistry.m +1 -29
  244. package/React/Base/Surface/RCTSurface.mm +1 -582
  245. package/React/Base/Surface/RCTSurfaceRootShadowView.m +0 -89
  246. package/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.mm +0 -1
  247. package/React/CoreModules/PlatformStubs/RCTStatusBarManager.mm +0 -2
  248. package/React/CoreModules/RCTAlertController.mm +1 -0
  249. package/React/CoreModules/RCTAlertManager.mm +0 -5
  250. package/React/CoreModules/RCTLogBox.mm +0 -11
  251. package/React/CoreModules/RCTLogBoxView.h +0 -3
  252. package/React/CoreModules/RCTLogBoxView.mm +0 -31
  253. package/React/CoreModules/RCTPerfMonitor.mm +0 -2
  254. package/React/CoreModules/RCTStatusBarManager.mm +0 -11
  255. package/React/CoreModules/React-CoreModules.podspec +1 -1
  256. package/React/CxxModule/RCTCxxUtils.h +0 -8
  257. package/React/CxxModule/RCTCxxUtils.mm +0 -17
  258. package/React/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec-generated.mm +179 -7
  259. package/React/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h +100 -2
  260. package/React/FBReactNativeSpec/FBReactNativeSpecJSI.h +373 -119
  261. package/React/FBReactNativeSpec/react/renderer/components/FBReactNativeSpec/ComponentDescriptors.cpp +1 -1
  262. package/React/FBReactNativeSpec/react/renderer/components/FBReactNativeSpec/ComponentDescriptors.h +1 -1
  263. package/React/FBReactNativeSpec/react/renderer/components/FBReactNativeSpec/EventEmitters.cpp +71 -71
  264. package/React/FBReactNativeSpec/react/renderer/components/FBReactNativeSpec/EventEmitters.h +96 -96
  265. package/React/FBReactNativeSpec/react/renderer/components/FBReactNativeSpec/Props.cpp +357 -363
  266. package/React/FBReactNativeSpec/react/renderer/components/FBReactNativeSpec/Props.h +211 -212
  267. package/React/FBReactNativeSpec/react/renderer/components/FBReactNativeSpec/RCTComponentViewHelpers.h +107 -107
  268. package/React/FBReactNativeSpec/react/renderer/components/FBReactNativeSpec/ShadowNodes.cpp +1 -1
  269. package/React/FBReactNativeSpec/react/renderer/components/FBReactNativeSpec/ShadowNodes.h +11 -11
  270. package/React/FBReactNativeSpec/react/renderer/components/FBReactNativeSpec/States.h +2 -2
  271. package/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.h +4 -0
  272. package/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm +4 -0
  273. package/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropCoordinatorAdapter.h +4 -0
  274. package/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropCoordinatorAdapter.mm +5 -0
  275. package/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.mm +0 -1
  276. package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.mm +14 -0
  277. package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +13 -4
  278. package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTVirtualViewContainerState.mm +12 -26
  279. package/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm +39 -4
  280. package/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm +1 -1
  281. package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +5 -5
  282. package/React/Fabric/Mounting/ComponentViews/VirtualView/RCTVirtualViewComponentView.mm +0 -18
  283. package/React/Fabric/Mounting/RCTComponentViewFactory.mm +9 -5
  284. package/React/Fabric/RCTSurfacePresenter.mm +86 -5
  285. package/React/Fabric/RCTSurfacePresenterBridgeAdapter.h +2 -0
  286. package/React/I18n/RCTLocalizedString.mm +38 -2
  287. package/React/Modules/RCTEventEmitter.m +30 -10
  288. package/React/Modules/RCTI18nUtil.m +3 -1
  289. package/React/Modules/RCTUIManager.mm +0 -1501
  290. package/React/React-RCTFBReactNativeSpec.podspec +2 -2
  291. package/React/React-RCTFabric.podspec +1 -1
  292. package/React/Runtime/React-RCTRuntime.podspec +1 -1
  293. package/React/Tests/Text/RCTAttributedTextUtilsTest.mm +27 -0
  294. package/React/Views/RCTModalHostViewController.h +0 -18
  295. package/React/Views/RCTModalHostViewManager.h +0 -24
  296. package/React/Views/RCTShadowView.h +0 -2
  297. package/React/Views/RCTShadowView.m +0 -723
  298. package/React/Views/RCTView.h +0 -19
  299. package/React/Views/RCTViewManager.m +0 -53
  300. package/React/Views/ScrollView/RCTScrollView.h +0 -92
  301. package/React/Views/ScrollView/RCTScrollableProtocol.h +0 -4
  302. package/React-Core-prebuilt.podspec +45 -17
  303. package/React-Core.podspec +10 -3
  304. package/React.podspec +1 -1
  305. package/ReactAndroid/api/ReactAndroid.api +128 -142
  306. package/ReactAndroid/build.gradle.kts +27 -22
  307. package/ReactAndroid/external-artifacts/build.gradle.kts +49 -0
  308. package/ReactAndroid/gradle.properties +1 -1
  309. package/ReactAndroid/hermes-engine/build.gradle.kts +19 -20
  310. package/ReactAndroid/publish.gradle +5 -5
  311. package/ReactAndroid/src/debug/AndroidManifest.xml +6 -0
  312. package/ReactAndroid/src/debugOptimized/AndroidManifest.xml +22 -0
  313. package/ReactAndroid/src/main/java/com/facebook/react/BaseReactPackage.kt +3 -7
  314. package/ReactAndroid/src/main/java/com/facebook/react/ReactActivityDelegate.java +4 -2
  315. package/ReactAndroid/src/main/java/com/facebook/react/ReactDelegate.kt +4 -6
  316. package/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java +0 -3
  317. package/ReactAndroid/src/main/java/com/facebook/react/ReactNativeHost.kt +212 -0
  318. package/ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java +0 -16
  319. package/ReactAndroid/src/main/java/com/facebook/react/animated/PropsAnimatedNode.kt +6 -1
  320. package/ReactAndroid/src/main/java/com/facebook/react/bridge/Arguments.kt +1 -0
  321. package/ReactAndroid/src/main/java/com/facebook/react/bridge/BridgeReactContext.kt +287 -0
  322. package/ReactAndroid/src/main/java/com/facebook/react/bridge/ColorPropConverter.kt +16 -0
  323. package/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java +15 -2
  324. package/ReactAndroid/src/main/java/com/facebook/react/bridge/interop/InteropModuleRegistry.kt +1 -3
  325. package/ReactAndroid/src/main/java/com/facebook/react/common/build/ReactBuildConfig.kt +4 -0
  326. package/ReactAndroid/src/main/java/com/facebook/react/common/mapbuffer/MapBuffer.kt +50 -2
  327. package/ReactAndroid/src/main/java/com/facebook/react/common/mapbuffer/ReadableMapBuffer.kt +63 -22
  328. package/ReactAndroid/src/main/java/com/facebook/react/common/mapbuffer/WritableMapBuffer.kt +33 -0
  329. package/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPoint.kt +4 -12
  330. package/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactActivityDelegate.kt +14 -10
  331. package/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactNativeHost.kt +6 -6
  332. package/ReactAndroid/src/main/java/com/facebook/react/devsupport/BundleDownloader.kt +50 -47
  333. package/ReactAndroid/src/main/java/com/facebook/react/devsupport/CxxInspectorPackagerConnection.kt +1 -1
  334. package/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevServerHelper.kt +0 -4
  335. package/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerFactory.kt +10 -10
  336. package/ReactAndroid/src/main/java/com/facebook/react/devsupport/LocalNetworkPermissionUtil.kt +49 -0
  337. package/ReactAndroid/src/main/java/com/facebook/react/devsupport/MultipartStreamReader.kt +101 -26
  338. package/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java +40 -38
  339. package/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManagerBinding.kt +1 -10
  340. package/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManagerProviderImpl.kt +0 -3
  341. package/ReactAndroid/src/main/java/com/facebook/react/fabric/ViewTransitionSnapshotManager.kt +15 -11
  342. package/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountItemDispatcher.kt +4 -4
  343. package/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountingManager.kt +7 -13
  344. package/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/SurfaceMountingManager.kt +160 -187
  345. package/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/SynchronousMountItem.kt +12 -8
  346. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt +30 -66
  347. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt +51 -111
  348. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt +11 -23
  349. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt +12 -24
  350. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt +57 -123
  351. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsOverrides_RNOSS_Canary_Android.kt +7 -5
  352. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsOverrides_RNOSS_Experimental_Android.kt +3 -5
  353. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt +11 -23
  354. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeNewArchitectureFeatureFlags.kt +0 -24
  355. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeNewArchitectureFeatureFlagsDefaults.kt +0 -4
  356. package/ReactAndroid/src/main/java/com/facebook/react/modules/appearance/AppearanceModule.kt +1 -0
  357. package/ReactAndroid/src/main/java/com/facebook/react/modules/core/JavaTimerManager.kt +2 -2
  358. package/ReactAndroid/src/main/java/com/facebook/react/modules/core/TimingModule.kt +3 -0
  359. package/ReactAndroid/src/main/java/com/facebook/react/modules/image/ImageLoaderModule.kt +50 -0
  360. package/ReactAndroid/src/main/java/com/facebook/react/modules/intent/IntentModule.kt +1 -1
  361. package/ReactAndroid/src/main/java/com/facebook/react/modules/network/NetworkEventUtil.kt +53 -3
  362. package/ReactAndroid/src/main/java/com/facebook/react/modules/network/NetworkingModule.kt +2 -2
  363. package/ReactAndroid/src/main/java/com/facebook/react/modules/statusbar/StatusBarModule.kt +2 -77
  364. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.kt +2 -2
  365. package/ReactAndroid/src/main/java/com/facebook/react/modules/websocket/WebSocketModule.kt +2 -2
  366. package/ReactAndroid/src/main/java/com/facebook/react/runtime/BridgelessCatalystInstance.kt +1 -1
  367. package/ReactAndroid/src/main/java/com/facebook/react/runtime/BridgelessReactContext.kt +9 -4
  368. package/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostImpl.kt +4 -19
  369. package/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactInstance.kt +2 -6
  370. package/ReactAndroid/src/main/java/com/facebook/react/touch/ReactInterceptingViewGroup.kt +4 -4
  371. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManager.java +47 -10
  372. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/DisplayMetricsHolder.kt +1 -49
  373. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/HasChildPressedStateDelay.kt +29 -0
  374. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/JSPointerDispatcher.kt +796 -0
  375. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/JSTouchDispatcher.kt +2 -4
  376. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/LayoutShadowNode.kt +27 -27
  377. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyManager.kt +184 -0
  378. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactShadowNode.kt +486 -0
  379. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactShadowNodeImpl.java +8 -8
  380. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ShadowNodeRegistry.kt +2 -2
  381. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/SkewMatrixHelper.kt +200 -0
  382. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ThemedReactContext.kt +3 -0
  383. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/TouchTargetHelper.kt +6 -1
  384. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/TransformHelper.kt +2 -2
  385. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIBlock.kt +7 -1
  386. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.kt +645 -0
  387. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModuleConstantsHelper.kt +2 -3
  388. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIViewOperationQueue.kt +142 -0
  389. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewGroupManager.kt +0 -10
  390. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManager.java +3 -3
  391. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagersPropertyCache.kt +527 -0
  392. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewProps.kt +3 -1
  393. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BorderRadiusStyle.kt +6 -6
  394. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/ColorStop.kt +6 -0
  395. package/ReactAndroid/src/main/java/com/facebook/react/util/AndroidVersion.kt +7 -0
  396. package/ReactAndroid/src/main/java/com/facebook/react/views/drawer/ReactDrawerLayout.kt +8 -1
  397. package/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostManager.kt +0 -3
  398. package/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostView.kt +2 -0
  399. package/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ReactProgressBarViewManager.kt +4 -4
  400. package/ReactAndroid/src/main/java/com/facebook/react/views/safeareaview/ReactSafeAreaView.kt +2 -0
  401. package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.kt +1729 -0
  402. package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollViewManager.kt +15 -15
  403. package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactNestedScrollView.kt +1297 -0
  404. package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactNestedScrollViewManager.kt +14 -14
  405. package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.kt +1392 -0
  406. package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewManager.kt +15 -15
  407. package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/VirtualViewContainer.kt +19 -33
  408. package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/VirtualViewContainerStateClassic.kt +8 -6
  409. package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/VirtualViewContainerStateExperimental.kt +4 -4
  410. package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/generate-nested-scroll-view.js +13 -20
  411. package/ReactAndroid/src/main/java/com/facebook/react/views/swiperefresh/ReactSwipeRefreshLayout.kt +7 -1
  412. package/ReactAndroid/src/main/java/com/facebook/react/views/text/MutableSpannableLayout.kt +107 -0
  413. package/ReactAndroid/src/main/java/com/facebook/react/views/text/PreparedLayoutTextView.kt +122 -10
  414. package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextView.java +92 -2
  415. package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextViewManager.kt +3 -0
  416. package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTypefaceUtils.kt +41 -0
  417. package/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.kt +48 -2
  418. package/ReactAndroid/src/main/java/com/facebook/react/views/text/TextDecorationStyle.kt +200 -0
  419. package/ReactAndroid/src/main/java/com/facebook/react/views/text/TextEffectRegistry.kt +45 -0
  420. package/ReactAndroid/src/main/java/com/facebook/react/views/text/TextEffectSpanFactory.kt +17 -0
  421. package/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManager.kt +361 -15
  422. package/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/AnimatedEffectSpan.kt +37 -0
  423. package/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/{DrawCommandSpan.kt → CanvasEffectSpan.kt} +3 -4
  424. package/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/CustomStyleSpan.kt +23 -3
  425. package/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/ReactStrikethroughSpan.kt +30 -3
  426. package/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/ReactUnderlineSpan.kt +25 -3
  427. package/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/SetSpanOperation.kt +1 -1
  428. package/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/StatefulSpan.kt +21 -0
  429. package/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/TextEffectSpan.kt +19 -0
  430. package/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/TouchableSpan.kt +29 -0
  431. package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.kt +83 -11
  432. package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.kt +6 -2
  433. package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextSelectionWatcher.kt +1 -1
  434. package/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.kt +3 -17
  435. package/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewManager.kt +8 -0
  436. package/ReactAndroid/src/main/java/com/facebook/react/views/view/WindowUtil.kt +2 -0
  437. package/ReactAndroid/src/main/java/com/facebook/react/views/virtual/VirtualViewRenderState.kt +1 -1
  438. package/ReactAndroid/src/main/java/com/facebook/react/views/virtual/view/ReactVirtualView.kt +7 -8
  439. package/ReactAndroid/src/main/java/com/facebook/yoga/YogaAlign.kt +45 -0
  440. package/ReactAndroid/src/main/java/com/facebook/yoga/YogaBoxSizing.kt +27 -0
  441. package/ReactAndroid/src/main/java/com/facebook/yoga/YogaConfig.kt +15 -0
  442. package/ReactAndroid/src/main/java/com/facebook/yoga/YogaConfigJNIBase.kt +6 -0
  443. package/ReactAndroid/src/main/java/com/facebook/yoga/YogaDimension.kt +27 -0
  444. package/ReactAndroid/src/main/java/com/facebook/yoga/YogaDisplay.kt +31 -0
  445. package/ReactAndroid/src/main/java/com/facebook/yoga/YogaEdge.kt +41 -0
  446. package/ReactAndroid/src/main/java/com/facebook/yoga/YogaErrata.kt +37 -0
  447. package/ReactAndroid/src/main/java/com/facebook/yoga/YogaExperimentalFeature.kt +27 -0
  448. package/ReactAndroid/src/main/java/com/facebook/yoga/YogaFlexDirection.kt +31 -0
  449. package/ReactAndroid/src/main/java/com/facebook/yoga/YogaGridTrackType.kt +33 -0
  450. package/ReactAndroid/src/main/java/com/facebook/yoga/YogaGutter.kt +29 -0
  451. package/ReactAndroid/src/main/java/com/facebook/yoga/YogaJustify.kt +43 -0
  452. package/ReactAndroid/src/main/java/com/facebook/yoga/YogaLogLevel.kt +39 -0
  453. package/ReactAndroid/src/main/java/com/facebook/yoga/YogaMeasureMode.kt +29 -0
  454. package/ReactAndroid/src/main/java/com/facebook/yoga/YogaNative.kt +16 -0
  455. package/ReactAndroid/src/main/java/com/facebook/yoga/YogaNode.kt +12 -2
  456. package/ReactAndroid/src/main/java/com/facebook/yoga/YogaNodeJNIBase.kt +762 -0
  457. package/ReactAndroid/src/main/java/com/facebook/yoga/YogaNodeJNIFinalizer.kt +4 -4
  458. package/ReactAndroid/src/main/java/com/facebook/yoga/YogaNodeType.kt +27 -0
  459. package/ReactAndroid/src/main/java/com/facebook/yoga/YogaOverflow.kt +29 -0
  460. package/ReactAndroid/src/main/java/com/facebook/yoga/YogaPositionType.kt +29 -0
  461. package/ReactAndroid/src/main/java/com/facebook/yoga/YogaProps.kt +24 -2
  462. package/ReactAndroid/src/main/java/com/facebook/yoga/YogaUnit.kt +37 -0
  463. package/ReactAndroid/src/main/java/com/facebook/yoga/YogaWrap.kt +29 -0
  464. package/ReactAndroid/src/main/jni/CMakeLists.txt +1 -2
  465. package/ReactAndroid/src/main/jni/first-party/yogajni/jni/YGJNIVanilla.cpp +94 -0
  466. package/ReactAndroid/src/main/jni/react/devsupport/JCxxInspectorPackagerConnectionDelegateImpl.cpp +3 -0
  467. package/ReactAndroid/src/main/jni/react/fabric/AndroidAnimationChoreographer.h +10 -10
  468. package/ReactAndroid/src/main/jni/react/fabric/CoreComponentsRegistry.cpp +3 -0
  469. package/ReactAndroid/src/main/jni/react/fabric/FabricUIManagerBinding.cpp +12 -15
  470. package/ReactAndroid/src/main/jni/react/fabric/FabricUIManagerBinding.h +1 -3
  471. package/ReactAndroid/src/main/jni/react/fabric/test/FabricMountingManagerTest.cpp +159 -0
  472. package/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp +69 -153
  473. package/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h +15 -33
  474. package/ReactAndroid/src/main/jni/react/jni/JReactMarker.cpp +10 -24
  475. package/ReactAndroid/src/main/jni/react/jni/JReactMarker.h +0 -2
  476. package/ReactAndroid/src/main/jni/react/mapbuffer/react/common/mapbuffer/JWritableMapBuffer.cpp +13 -0
  477. package/ReactAndroid/src/main/jni/react/runtime/jni/JReactInstance.cpp +4 -1
  478. package/ReactAndroid/src/main/jni/react/turbomodule/ReactCommon/TurboModuleManager.cpp +8 -0
  479. package/ReactAndroid/src/main/jni/react/turbomodule/ReactCommon/TurboModuleManager.h +4 -0
  480. package/ReactAndroid/src/main/res/views/uimanager/values/ids.xml +5 -0
  481. package/ReactAndroid/src/main/res/views/uimanager/values-zu/strings.xml +3 -0
  482. package/ReactApple/Libraries/RCTFoundation/RCTDeprecation/RCTDeprecation.podspec +1 -1
  483. package/ReactApple/RCTAnimatedModuleProvider/React-RCTAnimatedModuleProvider.podspec +63 -0
  484. package/ReactApple/RCTSwiftUI/RCTSwiftUI.podspec +1 -1
  485. package/ReactApple/RCTSwiftUIWrapper/RCTSwiftUIWrapper.podspec +1 -1
  486. package/ReactCommon/React-Fabric.podspec +3 -1
  487. package/ReactCommon/React-FabricComponents.podspec +1 -1
  488. package/ReactCommon/React-FabricImage.podspec +1 -1
  489. package/ReactCommon/React-Mapbuffer.podspec +1 -1
  490. package/ReactCommon/ReactCommon.podspec +3 -13
  491. package/ReactCommon/callinvoker/React-callinvoker.podspec +1 -1
  492. package/ReactCommon/cmake-utils/react-native-flags.cmake +1 -3
  493. package/ReactCommon/cxxreact/CMakeLists.txt +1 -0
  494. package/ReactCommon/cxxreact/ErrorUtils.h +2 -32
  495. package/ReactCommon/cxxreact/Instance.cpp +1 -26
  496. package/ReactCommon/cxxreact/Instance.h +0 -2
  497. package/ReactCommon/cxxreact/NativeToJsBridge.cpp +3 -2
  498. package/ReactCommon/cxxreact/RAMBundleRegistry.cpp +0 -12
  499. package/ReactCommon/cxxreact/RAMBundleRegistry.h +0 -5
  500. package/ReactCommon/cxxreact/React-cxxreact.podspec +3 -2
  501. package/ReactCommon/cxxreact/ReactMarker.cpp +4 -30
  502. package/ReactCommon/cxxreact/ReactMarker.h +38 -21
  503. package/ReactCommon/cxxreact/ReactNativeVersion.h +4 -4
  504. package/ReactCommon/cxxreact/TraceSection.h +1 -1
  505. package/ReactCommon/cxxreact/tests/methodcall.cpp +4 -0
  506. package/ReactCommon/hermes/React-hermes.podspec +1 -1
  507. package/ReactCommon/hermes/executor/HermesExecutorFactory.cpp +6 -79
  508. package/ReactCommon/hermes/executor/React-jsitracing.podspec +1 -1
  509. package/ReactCommon/jserrorhandler/ErrorUtils.cpp +42 -0
  510. package/{React/CxxLogUtils/RCTDefaultCxxLogFunction.h → ReactCommon/jserrorhandler/ErrorUtils.h} +2 -2
  511. package/ReactCommon/jserrorhandler/JsErrorHandler.cpp +1 -1
  512. package/ReactCommon/jserrorhandler/React-jserrorhandler.podspec +3 -4
  513. package/ReactCommon/jsi/React-jsi.podspec +1 -1
  514. package/ReactCommon/jsi/jsi/hermes-interfaces.h +53 -0
  515. package/ReactCommon/jsiexecutor/React-jsiexecutor.podspec +3 -2
  516. package/ReactCommon/jsiexecutor/jsireact/JSIExecutor.cpp +3 -14
  517. package/ReactCommon/jsiexecutor/jsireact/JSINativeModules.cpp +4 -13
  518. package/ReactCommon/jsinspector-modern/HostAgent.cpp +54 -0
  519. package/ReactCommon/jsinspector-modern/HostTarget.h +0 -7
  520. package/ReactCommon/jsinspector-modern/HostTargetTraceRecording.cpp +10 -7
  521. package/ReactCommon/jsinspector-modern/InspectorPackagerConnection.cpp +4 -1
  522. package/ReactCommon/jsinspector-modern/React-jsinspector.podspec +1 -1
  523. package/ReactCommon/jsinspector-modern/RuntimeAgent.cpp +7 -0
  524. package/ReactCommon/jsinspector-modern/RuntimeTarget.cpp +20 -0
  525. package/ReactCommon/jsinspector-modern/RuntimeTarget.h +16 -0
  526. package/ReactCommon/jsinspector-modern/SessionState.h +31 -0
  527. package/ReactCommon/jsinspector-modern/cdp/React-jsinspectorcdp.podspec +1 -1
  528. package/ReactCommon/jsinspector-modern/network/React-jsinspectornetwork.podspec +1 -1
  529. package/ReactCommon/jsinspector-modern/tests/HostTargetTest.cpp +53 -0
  530. package/ReactCommon/jsinspector-modern/tracing/HostTracingProfile.h +14 -1
  531. package/ReactCommon/jsinspector-modern/tracing/React-jsinspectortracing.podspec +1 -1
  532. package/ReactCommon/jsinspector-modern/tracing/TraceRecordingState.h +11 -0
  533. package/ReactCommon/jsitooling/React-jsitooling.podspec +1 -1
  534. package/ReactCommon/logger/React-logger.podspec +1 -1
  535. package/ReactCommon/oscompat/React-oscompat.podspec +1 -1
  536. package/ReactCommon/react/bridging/ArrayBuffer.h +180 -0
  537. package/ReactCommon/react/bridging/Bridging.h +1 -0
  538. package/ReactCommon/react/bridging/Convert.h +12 -0
  539. package/ReactCommon/react/bridging/React-bridging.podspec +44 -0
  540. package/ReactCommon/react/bridging/tests/BridgingTest.cpp +185 -11
  541. package/ReactCommon/react/bridging/tests/ClassTest.cpp +22 -0
  542. package/ReactCommon/react/cxxstableapi/CMakeLists.txt +18 -0
  543. package/ReactCommon/react/cxxstableapi/FrameworksGuard.h +35 -0
  544. package/ReactCommon/react/cxxstableapi/PrivateGuard.h +34 -0
  545. package/ReactCommon/react/cxxstableapi/React-cxxstableapi.podspec +34 -0
  546. package/ReactCommon/react/cxxstableapi/UmbrellaGuard.h +53 -0
  547. package/ReactCommon/react/debug/React-debug.podspec +1 -1
  548. package/ReactCommon/react/debug/redbox/JscSafeUrl.h +1 -1
  549. package/ReactCommon/react/featureflags/React-featureflags.podspec +1 -1
  550. package/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp +21 -45
  551. package/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h +26 -56
  552. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp +134 -242
  553. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h +14 -26
  554. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h +20 -44
  555. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h +43 -97
  556. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsOverridesOSSCanary.h +10 -6
  557. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsOverridesOSSExperimental.h +3 -7
  558. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsOverridesOSSStable.h +0 -8
  559. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h +7 -13
  560. package/ReactCommon/react/nativemodule/core/ReactCommon/TurboModule.h +1 -0
  561. package/ReactCommon/react/nativemodule/core/iostests/RCTTurboModuleTests.mm +49 -0
  562. package/ReactCommon/react/nativemodule/core/platform/android/ReactCommon/JavaInteropTurboModule.cpp +4 -0
  563. package/ReactCommon/react/nativemodule/core/platform/android/ReactCommon/JavaInteropTurboModule.h +4 -0
  564. package/ReactCommon/react/nativemodule/core/platform/android/ReactCommon/JavaTurboModule.cpp +2 -2
  565. package/ReactCommon/react/nativemodule/core/platform/ios/React-NativeModulesApple.podspec +2 -2
  566. package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTInteropTurboModule.h +4 -0
  567. package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTInteropTurboModule.mm +5 -1
  568. package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.mm +61 -4
  569. package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModuleManager.h +0 -9
  570. package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModuleManager.mm +37 -139
  571. package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModuleWithJSIBindings.h +0 -3
  572. package/ReactCommon/react/nativemodule/defaults/DefaultTurboModules.cpp +6 -0
  573. package/ReactCommon/react/nativemodule/defaults/React-defaultsnativemodule.podspec +1 -1
  574. package/ReactCommon/react/nativemodule/dom/NativeDOM.cpp +10 -4
  575. package/ReactCommon/react/nativemodule/dom/React-domnativemodule.podspec +2 -1
  576. package/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp +25 -55
  577. package/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h +11 -23
  578. package/ReactCommon/react/nativemodule/featureflags/React-featureflagsnativemodule.podspec +1 -1
  579. package/ReactCommon/react/nativemodule/idlecallbacks/React-idlecallbacksnativemodule.podspec +2 -1
  580. package/ReactCommon/react/nativemodule/intersectionobserver/React-intersectionobservernativemodule.podspec +2 -1
  581. package/ReactCommon/react/nativemodule/microtasks/React-microtasksnativemodule.podspec +1 -1
  582. package/ReactCommon/react/nativemodule/mutationobserver/NativeMutationObserver.cpp +4 -0
  583. package/ReactCommon/react/nativemodule/mutationobserver/React-mutationobservernativemodule.podspec +2 -1
  584. package/ReactCommon/react/nativemodule/samples/ReactCommon-Samples.podspec +1 -1
  585. package/ReactCommon/react/nativemodule/samples/platform/ios/ReactCommon/RCTSampleTurboModule.h +1 -1
  586. package/ReactCommon/react/nativemodule/viewtransition/React-viewtransitionnativemodule.podspec +1 -1
  587. package/ReactCommon/react/nativemodule/webperformance/React-webperformancenativemodule.podspec +2 -1
  588. package/ReactCommon/react/networking/React-networking.podspec +1 -1
  589. package/ReactCommon/react/performance/cdpmetrics/React-performancecdpmetrics.podspec +1 -1
  590. package/ReactCommon/react/performance/timeline/React-performancetimeline.podspec +1 -1
  591. package/ReactCommon/react/renderer/animated/NativeAnimatedNodesManager.cpp +95 -63
  592. package/ReactCommon/react/renderer/animated/NativeAnimatedNodesManager.h +20 -1
  593. package/ReactCommon/react/renderer/animated/NativeAnimatedNodesManagerProvider.cpp +7 -10
  594. package/ReactCommon/react/renderer/animated/drivers/FrameAnimationDriver.cpp +20 -1
  595. package/ReactCommon/react/renderer/animated/drivers/FrameAnimationDriver.h +1 -0
  596. package/ReactCommon/react/renderer/animated/internal/primitives.h +1 -1
  597. package/ReactCommon/react/renderer/animated/nodes/InterpolationAnimatedNode.cpp +67 -6
  598. package/ReactCommon/react/renderer/animated/nodes/InterpolationAnimatedNode.h +12 -0
  599. package/ReactCommon/react/renderer/animated/nodes/PropsAnimatedNode.cpp +25 -13
  600. package/ReactCommon/react/renderer/animated/nodes/PropsAnimatedNode.h +7 -0
  601. package/ReactCommon/react/renderer/animated/tests/AnimationDriverTests.cpp +48 -0
  602. package/ReactCommon/react/renderer/animated/tests/DecayAnimationDriverTest.cpp +245 -0
  603. package/ReactCommon/react/renderer/animated/tests/ManagedPropsMountingOverrideTests.cpp +204 -0
  604. package/ReactCommon/react/renderer/animationbackend/AnimatedPropsRegistry.cpp +10 -1
  605. package/ReactCommon/react/renderer/animationbackend/AnimatedPropsRegistry.h +1 -0
  606. package/ReactCommon/react/renderer/animationbackend/AnimationBackend.cpp +17 -0
  607. package/ReactCommon/react/renderer/animations/tests/LayoutAnimationTest.cpp +0 -2
  608. package/ReactCommon/react/renderer/attributedstring/TextAttributes.cpp +6 -2
  609. package/ReactCommon/react/renderer/attributedstring/TextAttributes.h +25 -1
  610. package/ReactCommon/react/renderer/attributedstring/conversions.h +29 -1
  611. package/ReactCommon/react/renderer/attributedstring/primitives.h +4 -2
  612. package/ReactCommon/react/renderer/attributedstring/tests/ParagraphAttributesTest.cpp +73 -0
  613. package/ReactCommon/react/renderer/componentregistry/ComponentDescriptorRegistry.cpp +6 -0
  614. package/ReactCommon/react/renderer/components/image/ImageProps.cpp +79 -126
  615. package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropShadowNode.cpp +4 -0
  616. package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropShadowNode.h +4 -0
  617. package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropState.h +4 -0
  618. package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropViewProps.cpp +5 -0
  619. package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropViewProps.h +4 -0
  620. package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/UnstableLegacyViewManagerAutomaticComponentDescriptor.cpp +5 -0
  621. package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/UnstableLegacyViewManagerAutomaticComponentDescriptor.h +4 -0
  622. package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/UnstableLegacyViewManagerAutomaticShadowNode.cpp +4 -0
  623. package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/UnstableLegacyViewManagerAutomaticShadowNode.h +4 -0
  624. package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/UnstableLegacyViewManagerInteropComponentDescriptor.h +4 -0
  625. package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/platform/ios/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropComponentDescriptor.h +4 -0
  626. package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/platform/ios/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropComponentDescriptor.mm +5 -0
  627. package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/platform/ios/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.h +4 -0
  628. package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/platform/ios/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.mm +5 -0
  629. package/ReactCommon/react/renderer/components/scrollview/BaseScrollViewProps.cpp +253 -379
  630. package/ReactCommon/react/renderer/components/scrollview/platform/android/react/renderer/components/scrollview/HostPlatformScrollViewProps.cpp +36 -55
  631. package/ReactCommon/react/renderer/components/text/BaseParagraphProps.cpp +17 -27
  632. package/ReactCommon/react/renderer/components/text/BaseTextProps.cpp +8 -10
  633. package/ReactCommon/react/renderer/components/text/BaseTextShadowNode.cpp +19 -0
  634. package/ReactCommon/react/renderer/components/text/TextEffectComponentDescriptor.h +17 -0
  635. package/ReactCommon/react/renderer/components/text/TextEffectProps.cpp +59 -0
  636. package/ReactCommon/react/renderer/components/text/TextEffectProps.h +30 -0
  637. package/{Libraries/Text/VirtualText/RCTVirtualTextView.mm → ReactCommon/react/renderer/components/text/TextEffectShadowNode.cpp} +4 -6
  638. package/ReactCommon/react/renderer/components/text/TextEffectShadowNode.h +26 -0
  639. package/ReactCommon/react/renderer/components/text/platform/android/react/renderer/components/text/HostPlatformParagraphProps.cpp +18 -28
  640. package/ReactCommon/react/renderer/components/text/tests/BaseTextShadowNodeTest.cpp +15 -0
  641. package/ReactCommon/react/renderer/components/textinput/platform/android/react/renderer/components/androidtextinput/AndroidTextInputProps.cpp +42 -50
  642. package/ReactCommon/react/renderer/components/view/AccessibilityProps.cpp +168 -754
  643. package/ReactCommon/react/renderer/components/view/AccessibilityProps.h +0 -9
  644. package/ReactCommon/react/renderer/components/view/BaseViewProps.cpp +262 -326
  645. package/ReactCommon/react/renderer/components/view/ViewShadowNode.cpp +0 -6
  646. package/ReactCommon/react/renderer/components/view/ViewShadowNode.h +2 -12
  647. package/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.cpp +73 -27
  648. package/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.h +7 -9
  649. package/ReactCommon/react/renderer/components/view/YogaStylableProps.cpp +3 -11
  650. package/ReactCommon/react/renderer/components/view/platform/android/react/renderer/components/view/HostPlatformViewProps.cpp +94 -180
  651. package/ReactCommon/react/renderer/components/view/platform/android/react/renderer/components/view/HostPlatformViewProps.h +2 -2
  652. package/ReactCommon/react/renderer/components/view/primitives.h +5 -0
  653. package/ReactCommon/react/renderer/components/view/propsConversions.h +74 -42
  654. package/ReactCommon/react/renderer/components/view/tests/LayoutTest.cpp +5 -5
  655. package/ReactCommon/react/renderer/components/view/tests/ViewTest.cpp +353 -6
  656. package/ReactCommon/react/renderer/consistency/React-rendererconsistency.podspec +1 -1
  657. package/ReactCommon/react/renderer/core/ConcreteComponentDescriptor.h +41 -16
  658. package/ReactCommon/react/renderer/core/ConcreteShadowNode.h +19 -0
  659. package/ReactCommon/react/renderer/core/EventEmitter.cpp +20 -4
  660. package/ReactCommon/react/renderer/core/LayoutMetrics.h +3 -0
  661. package/ReactCommon/react/renderer/core/Props.cpp +8 -39
  662. package/ReactCommon/react/renderer/core/Props.h +63 -13
  663. package/ReactCommon/react/renderer/core/RawProps.cpp +20 -3
  664. package/ReactCommon/react/renderer/core/RawProps.h +44 -0
  665. package/ReactCommon/react/renderer/core/RawPropsKeyMap.cpp +11 -27
  666. package/ReactCommon/react/renderer/core/RawPropsKeyMap.h +3 -3
  667. package/ReactCommon/react/renderer/core/RawPropsParser.cpp +4 -6
  668. package/ReactCommon/react/renderer/core/RawPropsParser.h +3 -3
  669. package/ReactCommon/react/renderer/core/StateData.h +4 -4
  670. package/ReactCommon/react/renderer/core/propsConversions.h +3 -7
  671. package/ReactCommon/react/renderer/core/tests/ComponentDescriptorTest.cpp +8 -0
  672. package/ReactCommon/react/renderer/core/tests/FindNodeAtPointTest.cpp +7 -7
  673. package/ReactCommon/react/renderer/core/tests/LayoutableShadowNodeTest.cpp +19 -19
  674. package/ReactCommon/react/renderer/core/tests/PropsConceptsTest.cpp +135 -0
  675. package/ReactCommon/react/renderer/core/tests/RawPropsTest.cpp +43 -53
  676. package/ReactCommon/react/renderer/css/React-renderercss.podspec +1 -1
  677. package/ReactCommon/react/renderer/debug/React-rendererdebug.podspec +1 -1
  678. package/ReactCommon/react/renderer/element/tests/ElementTest.cpp +3 -3
  679. package/ReactCommon/react/renderer/graphics/React-graphics.podspec +1 -1
  680. package/ReactCommon/react/renderer/imagemanager/platform/android/react/renderer/imagemanager/conversions.h +17 -0
  681. package/ReactCommon/react/renderer/imagemanager/platform/ios/React-ImageManager.podspec +1 -1
  682. package/ReactCommon/react/renderer/imagemanager/platform/ios/react/renderer/imagemanager/RCTSyncImageManager.mm +1 -1
  683. package/ReactCommon/react/renderer/mapbuffer/MapBuffer.cpp +123 -33
  684. package/ReactCommon/react/renderer/mapbuffer/MapBuffer.h +26 -14
  685. package/ReactCommon/react/renderer/mapbuffer/MapBufferBuilder.cpp +96 -53
  686. package/ReactCommon/react/renderer/mapbuffer/MapBufferBuilder.h +4 -0
  687. package/ReactCommon/react/renderer/mapbuffer/tests/MapBufferTest.cpp +96 -1
  688. package/ReactCommon/react/renderer/mounting/Differentiator.cpp +29 -318
  689. package/ReactCommon/react/renderer/mounting/ShadowTree.cpp +105 -33
  690. package/ReactCommon/react/renderer/mounting/ShadowTree.h +2 -0
  691. package/ReactCommon/react/renderer/mounting/internal/CullingContext.cpp +1 -1
  692. package/ReactCommon/react/renderer/mounting/tests/DifferentiatorUnflattenTest.cpp +11 -3
  693. package/ReactCommon/react/renderer/mounting/tests/OrderIndexTest.cpp +1 -1
  694. package/ReactCommon/react/renderer/mounting/tests/ShadowTreeLifeCycleTest.cpp +15 -250
  695. package/ReactCommon/react/renderer/mounting/tests/ShadowTreeReactBranchingTest.cpp +141 -0
  696. package/ReactCommon/react/renderer/mounting/tests/StackingContextTest.cpp +1 -1
  697. package/ReactCommon/react/renderer/runtimescheduler/CMakeLists.txt +1 -0
  698. package/ReactCommon/react/renderer/runtimescheduler/React-runtimescheduler.podspec +2 -1
  699. package/ReactCommon/react/renderer/runtimescheduler/RuntimeScheduler.cpp +22 -2
  700. package/ReactCommon/react/renderer/runtimescheduler/RuntimeScheduler.h +13 -2
  701. package/ReactCommon/react/renderer/runtimescheduler/RuntimeScheduler_Legacy.cpp +13 -0
  702. package/ReactCommon/react/renderer/runtimescheduler/RuntimeScheduler_Legacy.h +9 -0
  703. package/ReactCommon/react/renderer/runtimescheduler/RuntimeScheduler_Modern.cpp +43 -5
  704. package/ReactCommon/react/renderer/runtimescheduler/RuntimeScheduler_Modern.h +17 -1
  705. package/ReactCommon/react/renderer/runtimescheduler/Task.h +4 -0
  706. package/ReactCommon/react/renderer/runtimescheduler/tests/RuntimeSchedulerTest.cpp +113 -8
  707. package/ReactCommon/react/renderer/scheduler/Scheduler.cpp +14 -6
  708. package/ReactCommon/react/renderer/scheduler/Scheduler.h +3 -2
  709. package/ReactCommon/react/renderer/scheduler/SurfaceHandler.cpp +1 -85
  710. package/ReactCommon/react/renderer/scheduler/SurfaceHandler.h +0 -6
  711. package/ReactCommon/react/renderer/scheduler/tests/SchedulerDelegateInvalidationTest.cpp +671 -0
  712. package/ReactCommon/react/renderer/textlayoutmanager/TextMeasureCache.h +22 -5
  713. package/ReactCommon/react/renderer/textlayoutmanager/platform/android/react/renderer/textlayoutmanager/TextLayoutManager.cpp +4 -2
  714. package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.h +11 -0
  715. package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm +65 -26
  716. package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTTextLayoutManager.mm +193 -1
  717. package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTTextPrimitivesConversions.h +14 -2
  718. package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/TextLayoutManager.mm +2 -1
  719. package/ReactCommon/react/renderer/textlayoutmanager/tests/TextLayoutManagerTest.cpp +86 -5
  720. package/ReactCommon/react/renderer/uimanager/UIManager.cpp +31 -41
  721. package/ReactCommon/react/renderer/uimanager/UIManager.h +2 -2
  722. package/ReactCommon/react/renderer/uimanager/UIManagerDelegate.h +1 -1
  723. package/ReactCommon/react/renderer/uimanager/tests/FindShadowNodeByTagTest.cpp +1 -52
  724. package/ReactCommon/react/renderer/uimanager/tests/PointerEventsProcessorTest.cpp +4 -4
  725. package/ReactCommon/react/renderer/viewtransition/ViewTransitionModule.cpp +88 -39
  726. package/ReactCommon/react/renderer/viewtransition/ViewTransitionModule.h +12 -2
  727. package/ReactCommon/react/runtime/PlatformTimerRegistry.h +10 -0
  728. package/ReactCommon/react/runtime/React-RuntimeCore.podspec +1 -1
  729. package/ReactCommon/react/runtime/React-RuntimeHermes.podspec +1 -1
  730. package/ReactCommon/react/runtime/ReactInstance.cpp +79 -64
  731. package/ReactCommon/react/runtime/hermes/HermesInstance.cpp +0 -89
  732. package/ReactCommon/react/runtime/iostests/MainQueueCoordinatorTests.mm +99 -0
  733. package/ReactCommon/react/runtime/iostests/RCTInstanceTests.mm +244 -0
  734. package/ReactCommon/react/runtime/platform/ios/React-RuntimeApple.podspec +1 -1
  735. package/ReactCommon/react/runtime/platform/ios/ReactCommon/ObjCTimerRegistry.h +1 -1
  736. package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.mm +47 -30
  737. package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTJscInstance.mm +3 -2
  738. package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTPerformanceLoggerUtils.mm +3 -2
  739. package/ReactCommon/react/runtime/tests/cxx/ReactInstanceTest.cpp +27 -3
  740. package/ReactCommon/react/runtime/tests/cxx/RuntimeExecutorShutdownTest.cpp +155 -0
  741. package/ReactCommon/react/timing/React-timing.podspec +1 -1
  742. package/ReactCommon/react/utils/React-utils.podspec +1 -1
  743. package/ReactCommon/react/utils/Telemetry.h +0 -13
  744. package/ReactCommon/react/utils/tests/Base64Tests.cpp +36 -0
  745. package/ReactCommon/reactperflogger/React-perflogger.podspec +1 -1
  746. package/ReactCommon/reactperflogger/reactperflogger/ReactPerfettoLogger.cpp +0 -1
  747. package/ReactCommon/runtimeexecutor/React-runtimeexecutor.podspec +1 -1
  748. package/ReactCommon/runtimeexecutor/platform/ios/ReactCommon/RuntimeExecutorSyncUIThreadUtils.mm +21 -38
  749. package/ReactCommon/yoga/Yoga.podspec +2 -2
  750. package/ReactCommon/yoga/yoga/YGEnums.cpp +2 -0
  751. package/ReactCommon/yoga/yoga/YGEnums.h +1 -0
  752. package/ReactCommon/yoga/yoga/YGNode.cpp +27 -0
  753. package/ReactCommon/yoga/yoga/YGNode.h +69 -0
  754. package/ReactCommon/yoga/yoga/YGNodeLayout.h +0 -2
  755. package/ReactCommon/yoga/yoga/algorithm/CalculateLayout.cpp +283 -10
  756. package/ReactCommon/yoga/yoga/config/Config.h +1 -1
  757. package/ReactCommon/yoga/yoga/enums/Errata.h +1 -0
  758. package/ReactCommon/yoga/yoga/node/LayoutResults.h +8 -0
  759. package/ReactCommon/yoga/yoga/node/Node.cpp +32 -0
  760. package/ReactCommon/yoga/yoga/node/Node.h +33 -0
  761. package/cli.js +3 -182
  762. package/flow/bom.js.flow +42 -42
  763. package/flow/cssom.js.flow +21 -21
  764. package/flow/dom.js.flow +128 -128
  765. package/flow/global.js +6 -0
  766. package/gradle/libs.versions.toml +7 -5
  767. package/index.js +53 -86
  768. package/index.js.flow +53 -23
  769. package/package.json +39 -50
  770. package/react-native.config.js +82 -1
  771. package/scripts/cocoapods/fabric.rb +1 -1
  772. package/scripts/cocoapods/jsengine.rb +1 -1
  773. package/scripts/cocoapods/new_architecture.rb +1 -1
  774. package/scripts/cocoapods/rncore.rb +36 -78
  775. package/scripts/cocoapods/rncore_facades.rb +232 -0
  776. package/scripts/cocoapods/rndependencies.rb +64 -3
  777. package/scripts/cocoapods/rndeps_facades.rb +193 -0
  778. package/scripts/cocoapods/spm.rb +79 -12
  779. package/scripts/cocoapods/utils.rb +7 -9
  780. package/scripts/codegen/generate-artifacts-executor/generateSchemaInfos.js +0 -1
  781. package/scripts/codegen/templates/Package.swift.spm-template +97 -0
  782. package/scripts/codegen/templates/ReactAppDependencyProvider.podspec.template +1 -1
  783. package/scripts/codegen/templates/ReactCodegen.podspec.template +2 -2
  784. package/scripts/hermes/hermes-utils.js +27 -58
  785. package/scripts/ios-configure-glog.sh +1 -1
  786. package/scripts/react-native-xcode.sh +20 -0
  787. package/scripts/react_native_pods.rb +71 -21
  788. package/scripts/react_native_pods_utils/script_phases.sh +4 -3
  789. package/scripts/replace-rncore-version.js +57 -86
  790. package/scripts/setup-apple-spm.js +1267 -0
  791. package/scripts/spm/__doc__/rfc-spm-xcframework.md +707 -0
  792. package/scripts/spm/__doc__/spm-autolinking-plugins.md +244 -0
  793. package/scripts/spm/__doc__/spm-header-paths-contract.md +97 -0
  794. package/scripts/spm/__doc__/spm-plugins-assessment.md +128 -0
  795. package/scripts/spm/__doc__/spm-scripts.md +486 -0
  796. package/scripts/spm/autolinking-plugins.js +331 -0
  797. package/scripts/spm/download-spm-artifacts.js +1409 -0
  798. package/scripts/spm/expand-spm-dependencies.js +216 -0
  799. package/scripts/spm/flavored-frameworks.js +1008 -0
  800. package/scripts/spm/generate-spm-autolinking-config.js +221 -0
  801. package/scripts/spm/generate-spm-autolinking.js +1888 -0
  802. package/scripts/spm/generate-spm-package.js +302 -0
  803. package/scripts/spm/generate-spm-xcodeproj.js +2266 -0
  804. package/scripts/spm/read-podspec.js +695 -0
  805. package/scripts/spm/scaffold-package-swift.js +1206 -0
  806. package/scripts/spm/spm-pbxproj.js +654 -0
  807. package/scripts/spm/spm-types.js +520 -0
  808. package/scripts/spm/spm-utils.js +645 -0
  809. package/scripts/spm/sync-spm-autolinking.js +160 -0
  810. package/sdks/.hermesv1version +1 -1
  811. package/sdks/hermes-engine/hermes-engine.podspec +9 -39
  812. package/sdks/hermes-engine/hermes-utils.rb +20 -74
  813. package/sdks/hermes-engine/utils/replace_hermes_version.js +18 -4
  814. package/sdks/hermes-engine/version.properties +1 -2
  815. package/settings.gradle.kts +0 -43
  816. package/src/asset-registry.js +29 -0
  817. package/src/private/animated/NativeAnimatedHelper.js +45 -21
  818. package/src/private/assets/AssetRegistry.js +52 -0
  819. package/src/private/{specs_DEPRECATED/components → components/activityindicator/specs}/ActivityIndicatorViewNativeComponent.js +5 -5
  820. package/src/private/{specs_DEPRECATED/components → components/debuggingoverlay/specs}/DebuggingOverlayNativeComponent.js +8 -8
  821. package/src/private/{specs_DEPRECATED/components → components/drawerlayoutandroid/specs}/AndroidDrawerLayoutNativeComponent.js +8 -8
  822. package/src/private/{specs_DEPRECATED/components → components/inputaccessoryview/specs}/RCTInputAccessoryViewNativeComponent.js +4 -4
  823. package/src/private/{specs_DEPRECATED/components → components/modal/specs}/RCTModalHostViewNativeComponent.js +4 -9
  824. package/src/private/{specs_DEPRECATED/components → components/progressbarandroid/specs}/ProgressBarAndroidNativeComponent.js +5 -5
  825. package/src/private/{specs_DEPRECATED/components → components/refreshcontrol/specs}/AndroidSwipeRefreshLayoutNativeComponent.js +7 -7
  826. package/src/private/{specs_DEPRECATED/components → components/refreshcontrol/specs}/PullToRefreshViewNativeComponent.js +7 -7
  827. package/src/private/components/safeareaview/SafeAreaView_INTERNAL_DO_NOT_USE.js +2 -2
  828. package/src/private/{specs_DEPRECATED/components → components/safeareaview/specs}/RCTSafeAreaViewNativeComponent.js +3 -3
  829. package/src/private/components/scrollview/HScrollViewNativeComponents.js +1 -1
  830. package/src/private/{specs_DEPRECATED/components → components/scrollview/specs}/AndroidHorizontalScrollContentViewNativeComponent.js +3 -3
  831. package/src/private/{specs_DEPRECATED/components → components/switch/specs}/AndroidSwitchNativeComponent.js +7 -7
  832. package/src/private/{specs_DEPRECATED/components → components/switch/specs}/SwitchNativeComponent.js +10 -7
  833. package/src/private/{specs_DEPRECATED/components → components/unimplementedview/specs}/UnimplementedNativeViewNativeComponent.js +4 -4
  834. package/src/private/components/virtualcollection/Virtual.js +5 -5
  835. package/src/private/components/virtualcollection/VirtualCollectionView.js +2 -6
  836. package/src/private/components/virtualcollection/column/VirtualColumn.js +1 -1
  837. package/src/private/components/virtualcollection/row/VirtualRow.js +1 -1
  838. package/src/private/devsupport/devmenu/elementinspector/Inspector.js +3 -1
  839. package/src/private/devsupport/devmenu/specs/NativeDevMenu.js +4 -4
  840. package/src/private/devsupport/rndevtools/specs/NativeReactDevToolsRuntimeSettingsModule.js +4 -2
  841. package/src/private/devsupport/rndevtools/specs/NativeReactDevToolsSettingsManager.js +2 -2
  842. package/src/private/featureflags/ReactNativeFeatureFlags.js +46 -70
  843. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +88 -94
  844. package/src/private/renderer/errorhandling/ErrorHandlers.js +2 -2
  845. package/src/private/renderer/events/ReactNativeResponder.js +49 -4
  846. package/src/private/renderer/events/ResponderTouchHistoryStore.js +11 -2
  847. package/src/private/renderer/events/dispatchNativeEvent.js +71 -36
  848. package/src/private/setup/setUpDOM.js +19 -9
  849. package/src/private/setup/setUpIntersectionObserver.js +7 -0
  850. package/src/private/setup/setUpMutationObserver.js +3 -1
  851. package/src/private/specs_DEPRECATED/modules/NativeAccessibilityInfo.js +9 -9
  852. package/src/private/specs_DEPRECATED/modules/NativeAccessibilityManager.js +24 -24
  853. package/src/private/specs_DEPRECATED/modules/NativeActionSheetManager.js +28 -28
  854. package/src/private/specs_DEPRECATED/modules/NativeAlertManager.js +1 -1
  855. package/src/private/specs_DEPRECATED/modules/NativeAnimatedModule.js +45 -25
  856. package/src/private/specs_DEPRECATED/modules/NativeAnimatedTurboModule.js +44 -24
  857. package/src/private/specs_DEPRECATED/modules/NativeAppState.js +4 -4
  858. package/src/private/specs_DEPRECATED/modules/NativeAppearance.js +8 -6
  859. package/src/private/specs_DEPRECATED/modules/NativeBlobModule.js +7 -7
  860. package/src/private/specs_DEPRECATED/modules/NativeClipboard.js +3 -3
  861. package/src/private/specs_DEPRECATED/modules/NativeDevLoadingView.js +2 -2
  862. package/src/private/specs_DEPRECATED/modules/NativeDevSettings.js +11 -11
  863. package/src/private/specs_DEPRECATED/modules/NativeDeviceEventManager.js +1 -1
  864. package/src/private/specs_DEPRECATED/modules/NativeDeviceInfo.js +4 -4
  865. package/src/private/specs_DEPRECATED/modules/NativeDialogManagerAndroid.js +7 -7
  866. package/src/private/specs_DEPRECATED/modules/NativeExceptionsManager.js +4 -4
  867. package/src/private/specs_DEPRECATED/modules/NativeFileReaderModule.js +2 -2
  868. package/src/private/specs_DEPRECATED/modules/NativeFrameRateLogger.js +4 -4
  869. package/src/private/specs_DEPRECATED/modules/NativeHeadlessJsTaskSupport.js +2 -2
  870. package/src/private/specs_DEPRECATED/modules/NativeI18nManager.js +1 -1
  871. package/src/private/specs_DEPRECATED/modules/NativeImageEditor.js +13 -13
  872. package/src/private/specs_DEPRECATED/modules/NativeImageLoaderAndroid.js +9 -6
  873. package/src/private/specs_DEPRECATED/modules/NativeImageLoaderIOS.js +6 -6
  874. package/src/private/specs_DEPRECATED/modules/NativeImageStoreAndroid.js +2 -2
  875. package/src/private/specs_DEPRECATED/modules/NativeImageStoreIOS.js +8 -5
  876. package/src/private/specs_DEPRECATED/modules/NativeIntentAndroid.js +5 -5
  877. package/src/private/specs_DEPRECATED/modules/NativeJSCHeapCapture.js +1 -1
  878. package/src/private/specs_DEPRECATED/modules/NativeKeyboardObserver.js +2 -2
  879. package/src/private/specs_DEPRECATED/modules/NativeLinkingManager.js +6 -6
  880. package/src/private/specs_DEPRECATED/modules/NativeLogBox.js +2 -2
  881. package/src/private/specs_DEPRECATED/modules/NativeModalManager.js +2 -2
  882. package/src/private/specs_DEPRECATED/modules/NativeNetworkingAndroid.js +5 -5
  883. package/src/private/specs_DEPRECATED/modules/NativeNetworkingIOS.js +6 -6
  884. package/src/private/specs_DEPRECATED/modules/NativePermissionsAndroid.js +6 -4
  885. package/src/private/specs_DEPRECATED/modules/NativePlatformConstantsAndroid.js +2 -2
  886. package/src/private/specs_DEPRECATED/modules/NativePlatformConstantsIOS.js +1 -1
  887. package/src/private/specs_DEPRECATED/modules/NativePushNotificationManagerIOS.js +35 -31
  888. package/src/private/specs_DEPRECATED/modules/NativeRedBox.js +2 -2
  889. package/src/private/specs_DEPRECATED/modules/NativeSampleTurboModule.js +24 -24
  890. package/src/private/specs_DEPRECATED/modules/NativeSegmentFetcher.js +2 -2
  891. package/src/private/specs_DEPRECATED/modules/NativeSettingsManager.js +3 -3
  892. package/src/private/specs_DEPRECATED/modules/NativeShareModule.js +2 -2
  893. package/src/private/specs_DEPRECATED/modules/NativeSoundManager.js +1 -1
  894. package/src/private/specs_DEPRECATED/modules/NativeSourceCode.js +1 -1
  895. package/src/private/specs_DEPRECATED/modules/NativeStatusBarManagerAndroid.js +5 -17
  896. package/src/private/specs_DEPRECATED/modules/NativeStatusBarManagerIOS.js +10 -15
  897. package/src/private/specs_DEPRECATED/modules/NativeTiming.js +3 -3
  898. package/src/private/specs_DEPRECATED/modules/NativeToastAndroid.js +4 -4
  899. package/src/private/specs_DEPRECATED/modules/NativeUIManager.js +35 -22
  900. package/src/private/specs_DEPRECATED/modules/NativeVibration.js +4 -4
  901. package/src/private/specs_DEPRECATED/modules/NativeWebSocketModule.js +7 -7
  902. package/src/private/types/HostInstance.js +38 -80
  903. package/src/private/viewtransition/specs/NativeViewTransition.js +6 -4
  904. package/src/private/webapis/dom/abort-api/AbortController.js +92 -0
  905. package/src/private/webapis/dom/abort-api/AbortSignal.js +243 -0
  906. package/src/private/webapis/dom/events/CustomEvent.js +1 -1
  907. package/src/private/webapis/dom/events/Event.js +12 -12
  908. package/src/private/webapis/dom/events/EventTarget.js +146 -37
  909. package/src/private/webapis/dom/events/internals/EventInternals.js +36 -0
  910. package/src/private/webapis/dom/events/internals/EventTargetInternals.js +38 -3
  911. package/src/private/webapis/dom/nodes/ReactNativeDocument.js +11 -0
  912. package/src/private/webapis/dom/nodes/ReactNativeElement.js +105 -4
  913. package/src/private/webapis/dom/nodes/ReadOnlyCharacterData.js +11 -0
  914. package/src/private/webapis/dom/nodes/ReadOnlyElement.js +9 -0
  915. package/src/private/webapis/dom/nodes/ReadOnlyNode.js +34 -7
  916. package/src/private/webapis/dom/nodes/ReadOnlyText.js +33 -0
  917. package/src/private/webapis/dom/nodes/specs/NativeDOM.js +46 -42
  918. package/src/private/webapis/dom/oldstylecollections/HTMLCollection.js +12 -0
  919. package/src/private/webapis/dom/oldstylecollections/HTMLCollection.js.flow +4 -2
  920. package/src/private/webapis/dom/oldstylecollections/NodeList.js +10 -0
  921. package/src/private/webapis/dom/oldstylecollections/NodeList.js.flow +4 -3
  922. package/src/private/webapis/errors/DOMException.js +50 -50
  923. package/src/private/webapis/geometry/DOMRectList.js +12 -0
  924. package/src/private/webapis/geometry/DOMRectList.js.flow +3 -1
  925. package/src/private/webapis/html/events/MessageEvent.js +3 -3
  926. package/src/private/webapis/idlecallbacks/specs/NativeIdleCallbacks.js +2 -2
  927. package/src/private/webapis/intersectionobserver/IntersectionObserverEntry.js +13 -0
  928. package/src/private/webapis/intersectionobserver/internals/IntersectionObserverManager.js +3 -7
  929. package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +5 -5
  930. package/src/private/webapis/microtasks/specs/NativeMicrotasks.js +1 -1
  931. package/src/private/webapis/mutationobserver/MutationObserver.js +7 -7
  932. package/src/private/webapis/mutationobserver/MutationRecord.js +12 -0
  933. package/src/private/webapis/mutationobserver/internals/MutationObserverManager.js +5 -7
  934. package/src/private/webapis/mutationobserver/specs/NativeMutationObserver.js +5 -5
  935. package/src/private/webapis/performance/EventTiming.js +3 -3
  936. package/src/private/webapis/performance/PerformanceEntry.js +3 -3
  937. package/src/private/webapis/performance/PerformanceObserver.js +4 -4
  938. package/src/private/webapis/performance/ResourceTiming.js +13 -13
  939. package/src/private/webapis/performance/UserTiming.js +3 -3
  940. package/src/private/webapis/performance/internals/Utilities.js +1 -1
  941. package/src/private/webapis/performance/specs/NativePerformance.js +26 -20
  942. package/src/private/webapis/utils/ArrayLikeUtils.js +1 -1
  943. package/src/private/webapis/websockets/events/CloseEvent.js +3 -3
  944. package/src/private/webapis/xhr/events/ProgressEvent.js +3 -3
  945. package/src/react-private-interface.js +145 -0
  946. package/src/react-private-interface.js.flow +48 -0
  947. package/src/setup-env.js +22 -0
  948. package/src/types/globals.d.ts +35 -3
  949. package/src/unstable-internals-do-not-use.d.ts +214 -0
  950. package/src/unstable-internals-do-not-use.js +76 -0
  951. package/third-party-podspecs/RCT-Folly.podspec +1 -1
  952. package/third-party-podspecs/ReactNativeDependencies.podspec +3 -3
  953. package/third-party-podspecs/glog.podspec +1 -1
  954. package/types/index.d.ts +0 -1
  955. package/types/public/DeprecatedPropertiesAlias.d.ts +0 -4
  956. package/types/public/ReactNativeTypes.d.ts +6 -4
  957. package/Libraries/AppDelegate/RCTArchConfiguratorProtocol.h +0 -38
  958. package/Libraries/Image/AssetRegistry.js +0 -14
  959. package/Libraries/Image/RCTImageShadowView.h +0 -17
  960. package/Libraries/Image/RCTImageShadowView.mm +0 -28
  961. package/Libraries/Image/RCTImageView.h +0 -32
  962. package/Libraries/Image/RCTImageView.mm +0 -507
  963. package/Libraries/Image/RCTImageViewManager.h +0 -17
  964. package/Libraries/Image/RCTImageViewManager.mm +0 -115
  965. package/Libraries/Interaction/InteractionManager.d.ts +0 -87
  966. package/Libraries/Interaction/InteractionManager.js +0 -189
  967. package/Libraries/Text/BaseText/RCTBaseTextShadowView.h +0 -35
  968. package/Libraries/Text/BaseText/RCTBaseTextShadowView.mm +0 -162
  969. package/Libraries/Text/BaseText/RCTBaseTextViewManager.h +0 -21
  970. package/Libraries/Text/BaseText/RCTBaseTextViewManager.mm +0 -64
  971. package/Libraries/Text/RCTTextAttributes.h +0 -107
  972. package/Libraries/Text/RCTTextAttributes.mm +0 -358
  973. package/Libraries/Text/RawText/RCTRawTextShadowView.h +0 -23
  974. package/Libraries/Text/RawText/RCTRawTextShadowView.mm +0 -38
  975. package/Libraries/Text/RawText/RCTRawTextViewManager.h +0 -21
  976. package/Libraries/Text/RawText/RCTRawTextViewManager.mm +0 -32
  977. package/Libraries/Text/Text/RCTTextShadowView.h +0 -33
  978. package/Libraries/Text/Text/RCTTextShadowView.mm +0 -469
  979. package/Libraries/Text/Text/RCTTextView.h +0 -34
  980. package/Libraries/Text/Text/RCTTextView.mm +0 -308
  981. package/Libraries/Text/Text/RCTTextViewManager.h +0 -19
  982. package/Libraries/Text/Text/RCTTextViewManager.mm +0 -97
  983. package/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.h +0 -21
  984. package/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.mm +0 -67
  985. package/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputViewManager.h +0 -21
  986. package/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputViewManager.mm +0 -30
  987. package/Libraries/Text/TextInput/RCTBaseTextInputShadowView.h +0 -30
  988. package/Libraries/Text/TextInput/RCTBaseTextInputShadowView.mm +0 -367
  989. package/Libraries/Text/TextInput/RCTBaseTextInputView.h +0 -68
  990. package/Libraries/Text/TextInput/RCTBaseTextInputView.mm +0 -858
  991. package/Libraries/Text/TextInput/RCTBaseTextInputViewManager.h +0 -17
  992. package/Libraries/Text/TextInput/RCTBaseTextInputViewManager.mm +0 -181
  993. package/Libraries/Text/TextInput/RCTInputAccessoryShadowView.h +0 -17
  994. package/Libraries/Text/TextInput/RCTInputAccessoryShadowView.mm +0 -24
  995. package/Libraries/Text/TextInput/RCTInputAccessoryView.h +0 -22
  996. package/Libraries/Text/TextInput/RCTInputAccessoryView.mm +0 -82
  997. package/Libraries/Text/TextInput/RCTInputAccessoryViewContent.h +0 -17
  998. package/Libraries/Text/TextInput/RCTInputAccessoryViewContent.mm +0 -78
  999. package/Libraries/Text/TextInput/RCTInputAccessoryViewManager.h +0 -17
  1000. package/Libraries/Text/TextInput/RCTInputAccessoryViewManager.mm +0 -33
  1001. package/Libraries/Text/TextInput/Singleline/RCTSinglelineTextInputView.h +0 -21
  1002. package/Libraries/Text/TextInput/Singleline/RCTSinglelineTextInputView.mm +0 -43
  1003. package/Libraries/Text/TextInput/Singleline/RCTSinglelineTextInputViewManager.h +0 -21
  1004. package/Libraries/Text/TextInput/Singleline/RCTSinglelineTextInputViewManager.mm +0 -35
  1005. package/Libraries/Text/VirtualText/RCTVirtualTextShadowView.h +0 -17
  1006. package/Libraries/Text/VirtualText/RCTVirtualTextShadowView.mm +0 -42
  1007. package/Libraries/Text/VirtualText/RCTVirtualTextView.h +0 -28
  1008. package/Libraries/Text/VirtualText/RCTVirtualTextViewManager.h +0 -17
  1009. package/Libraries/Text/VirtualText/RCTVirtualTextViewManager.mm +0 -30
  1010. package/Libraries/Utilities/SceneTracker.js +0 -42
  1011. package/Libraries/Wrapper/Example/RCTWrapperExampleView.h +0 -21
  1012. package/Libraries/Wrapper/Example/RCTWrapperExampleView.m +0 -57
  1013. package/Libraries/Wrapper/Example/RCTWrapperExampleViewController.h +0 -21
  1014. package/Libraries/Wrapper/Example/RCTWrapperExampleViewController.m +0 -27
  1015. package/Libraries/Wrapper/Example/RCTWrapperReactRootViewController.h +0 -25
  1016. package/Libraries/Wrapper/Example/RCTWrapperReactRootViewController.m +0 -50
  1017. package/Libraries/Wrapper/Example/RCTWrapperReactRootViewManager.h +0 -23
  1018. package/Libraries/Wrapper/Example/RCTWrapperReactRootViewManager.m +0 -35
  1019. package/Libraries/Wrapper/RCTWrapper.h +0 -73
  1020. package/Libraries/Wrapper/RCTWrapperShadowView.h +0 -27
  1021. package/Libraries/Wrapper/RCTWrapperShadowView.m +0 -138
  1022. package/Libraries/Wrapper/RCTWrapperView.h +0 -42
  1023. package/Libraries/Wrapper/RCTWrapperView.m +0 -99
  1024. package/Libraries/Wrapper/RCTWrapperViewControllerHostingView.h +0 -30
  1025. package/Libraries/Wrapper/RCTWrapperViewControllerHostingView.m +0 -137
  1026. package/Libraries/Wrapper/RCTWrapperViewManager.h +0 -25
  1027. package/Libraries/Wrapper/RCTWrapperViewManager.m +0 -31
  1028. package/React/Base/RCTRootContentView.h +0 -43
  1029. package/React/Base/RCTRootContentView.m +0 -111
  1030. package/React/Base/RCTRootViewInternal.h +0 -40
  1031. package/React/CxxBridge/RCTCxxBridge.mm +0 -1572
  1032. package/React/CxxBridge/RCTJSIExecutorRuntimeInstaller.h +0 -25
  1033. package/React/CxxBridge/RCTJSIExecutorRuntimeInstaller.mm +0 -34
  1034. package/React/CxxBridge/RCTObjcExecutor.h +0 -34
  1035. package/React/CxxBridge/RCTObjcExecutor.mm +0 -150
  1036. package/React/CxxLogUtils/RCTDefaultCxxLogFunction.mm +0 -34
  1037. package/React/CxxModule/DispatchMessageQueueThread.h +0 -50
  1038. package/React/CxxModule/RCTCxxMethod.h +0 -17
  1039. package/React/CxxModule/RCTCxxMethod.mm +0 -147
  1040. package/React/CxxModule/RCTNativeModule.h +0 -34
  1041. package/React/CxxModule/RCTNativeModule.mm +0 -241
  1042. package/React/Fabric/RCTSurfacePresenterBridgeAdapter.mm +0 -205
  1043. package/React/Tests/Text/RCTTextAttributesTest.mm +0 -49
  1044. package/React/Views/RCTActivityIndicatorView.h +0 -16
  1045. package/React/Views/RCTActivityIndicatorView.m +0 -26
  1046. package/React/Views/RCTActivityIndicatorViewManager.h +0 -23
  1047. package/React/Views/RCTActivityIndicatorViewManager.m +0 -65
  1048. package/React/Views/RCTDebuggingOverlayManager.h +0 -17
  1049. package/React/Views/RCTDebuggingOverlayManager.m +0 -68
  1050. package/React/Views/RCTModalHostView.h +0 -72
  1051. package/React/Views/RCTModalHostView.m +0 -302
  1052. package/React/Views/RCTModalHostViewController.m +0 -107
  1053. package/React/Views/RCTModalHostViewManager.m +0 -131
  1054. package/React/Views/RCTModalManager.h +0 -22
  1055. package/React/Views/RCTModalManager.m +0 -46
  1056. package/React/Views/RCTRootShadowView.h +0 -35
  1057. package/React/Views/RCTRootShadowView.m +0 -53
  1058. package/React/Views/RCTShadowView+Internal.h +0 -18
  1059. package/React/Views/RCTShadowView+Internal.m +0 -23
  1060. package/React/Views/RCTSwitch.h +0 -24
  1061. package/React/Views/RCTSwitch.m +0 -26
  1062. package/React/Views/RCTSwitchManager.h +0 -19
  1063. package/React/Views/RCTSwitchManager.m +0 -72
  1064. package/React/Views/RCTTVView.h +0 -105
  1065. package/React/Views/RCTTVView.m +0 -602
  1066. package/React/Views/RefreshControl/RCTRefreshControl.h +0 -26
  1067. package/React/Views/RefreshControl/RCTRefreshControl.m +0 -232
  1068. package/React/Views/RefreshControl/RCTRefreshControlManager.h +0 -19
  1069. package/React/Views/RefreshControl/RCTRefreshControlManager.m +0 -49
  1070. package/React/Views/SafeAreaView/RCTSafeAreaShadowView.h +0 -21
  1071. package/React/Views/SafeAreaView/RCTSafeAreaShadowView.m +0 -57
  1072. package/React/Views/SafeAreaView/RCTSafeAreaView.h +0 -27
  1073. package/React/Views/SafeAreaView/RCTSafeAreaView.m +0 -79
  1074. package/React/Views/SafeAreaView/RCTSafeAreaViewLocalData.h +0 -25
  1075. package/React/Views/SafeAreaView/RCTSafeAreaViewLocalData.m +0 -25
  1076. package/React/Views/SafeAreaView/RCTSafeAreaViewManager.h +0 -21
  1077. package/React/Views/SafeAreaView/RCTSafeAreaViewManager.m +0 -32
  1078. package/React/Views/ScrollView/RCTScrollContentShadowView.h +0 -19
  1079. package/React/Views/ScrollView/RCTScrollContentShadowView.m +0 -35
  1080. package/React/Views/ScrollView/RCTScrollContentView.h +0 -19
  1081. package/React/Views/ScrollView/RCTScrollContentView.m +0 -36
  1082. package/React/Views/ScrollView/RCTScrollContentViewManager.h +0 -17
  1083. package/React/Views/ScrollView/RCTScrollContentViewManager.m +0 -31
  1084. package/React/Views/ScrollView/RCTScrollView.m +0 -1508
  1085. package/React/Views/ScrollView/RCTScrollViewManager.h +0 -25
  1086. package/React/Views/ScrollView/RCTScrollViewManager.m +0 -208
  1087. package/ReactAndroid/src/main/java/com/facebook/react/ReactNativeHost.java +0 -251
  1088. package/ReactAndroid/src/main/java/com/facebook/react/bridge/BridgeReactContext.java +0 -315
  1089. package/ReactAndroid/src/main/java/com/facebook/react/common/ClearableSynchronizedPool.kt +0 -51
  1090. package/ReactAndroid/src/main/java/com/facebook/react/fabric/AnimationBackendChoreographer.kt +0 -89
  1091. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/JSPointerDispatcher.java +0 -736
  1092. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyManager.java +0 -221
  1093. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactShadowNode.java +0 -399
  1094. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactZIndexedViewGroup.kt +0 -35
  1095. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIImplementation.java +0 -346
  1096. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.java +0 -666
  1097. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIViewOperationQueue.java +0 -147
  1098. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewGroupDrawingOrderHelper.kt +0 -113
  1099. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagersPropertyCache.java +0 -614
  1100. package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java +0 -1949
  1101. package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactNestedScrollView.java +0 -1646
  1102. package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java +0 -1744
  1103. package/ReactAndroid/src/main/java/com/facebook/yoga/YogaAlign.java +0 -51
  1104. package/ReactAndroid/src/main/java/com/facebook/yoga/YogaBoxSizing.java +0 -33
  1105. package/ReactAndroid/src/main/java/com/facebook/yoga/YogaDimension.java +0 -33
  1106. package/ReactAndroid/src/main/java/com/facebook/yoga/YogaDisplay.java +0 -37
  1107. package/ReactAndroid/src/main/java/com/facebook/yoga/YogaEdge.java +0 -47
  1108. package/ReactAndroid/src/main/java/com/facebook/yoga/YogaErrata.java +0 -41
  1109. package/ReactAndroid/src/main/java/com/facebook/yoga/YogaExperimentalFeature.java +0 -33
  1110. package/ReactAndroid/src/main/java/com/facebook/yoga/YogaFlexDirection.java +0 -37
  1111. package/ReactAndroid/src/main/java/com/facebook/yoga/YogaGridTrackType.java +0 -39
  1112. package/ReactAndroid/src/main/java/com/facebook/yoga/YogaGutter.java +0 -35
  1113. package/ReactAndroid/src/main/java/com/facebook/yoga/YogaJustify.java +0 -49
  1114. package/ReactAndroid/src/main/java/com/facebook/yoga/YogaLogLevel.java +0 -45
  1115. package/ReactAndroid/src/main/java/com/facebook/yoga/YogaMeasureMode.java +0 -35
  1116. package/ReactAndroid/src/main/java/com/facebook/yoga/YogaNodeJNIBase.java +0 -928
  1117. package/ReactAndroid/src/main/java/com/facebook/yoga/YogaNodeType.java +0 -33
  1118. package/ReactAndroid/src/main/java/com/facebook/yoga/YogaOverflow.java +0 -35
  1119. package/ReactAndroid/src/main/java/com/facebook/yoga/YogaPositionType.java +0 -35
  1120. package/ReactAndroid/src/main/java/com/facebook/yoga/YogaUnit.java +0 -43
  1121. package/ReactAndroid/src/main/java/com/facebook/yoga/YogaWrap.java +0 -35
  1122. package/ReactAndroid/src/main/jni/react/fabric/JAnimationBackendChoreographer.cpp +0 -23
  1123. package/ReactAndroid/src/main/jni/react/fabric/JAnimationBackendChoreographer.h +0 -37
  1124. package/ReactCommon/cxxreact/JSIndexedRAMBundle.cpp +0 -135
  1125. package/ReactCommon/cxxreact/JSIndexedRAMBundle.h +0 -72
  1126. package/ReactCommon/hermes/inspector-modern/chrome/ConnectionDemux.cpp +0 -143
  1127. package/ReactCommon/hermes/inspector-modern/chrome/ConnectionDemux.h +0 -55
  1128. package/ReactCommon/hermes/inspector-modern/chrome/Registration.cpp +0 -78
  1129. package/ReactCommon/hermes/inspector-modern/chrome/Registration.h +0 -39
  1130. package/ReactCommon/hermes/inspector-modern/chrome/tests/ConnectionDemuxTests.cpp +0 -148
  1131. package/ReactCommon/react/nativemodule/samples/platform/android/NativeSampleTurboModuleSpec.java +0 -168
  1132. package/ReactCommon/react/nativemodule/samples/platform/android/ReactCommon/SampleTurboModuleSpec.cpp +0 -416
  1133. package/ReactCommon/react/nativemodule/samples/platform/android/ReactCommon/SampleTurboModuleSpec.h +0 -31
  1134. package/ReactCommon/react/nativemodule/samples/platform/ios/ReactCommon/RCTNativeSampleTurboModuleSpec.h +0 -134
  1135. package/ReactCommon/react/nativemodule/samples/platform/ios/ReactCommon/RCTNativeSampleTurboModuleSpec.mm +0 -290
  1136. package/ReactCommon/react/renderer/core/RawPropsKey.cpp +0 -62
  1137. package/ReactCommon/react/renderer/core/RawPropsKey.h +0 -39
  1138. package/ReactCommon/react/renderer/mounting/internal/DiffMap.h +0 -170
  1139. package/ReactCommon/react/renderer/mounting/internal/LongestIncreasingSubsequence.h +0 -95
  1140. package/ReactCommon/react/renderer/mounting/internal/TinyMap.h +0 -147
  1141. package/ReactCommon/react/renderer/mounting/tests/LongestIncreasingSubsequenceTest.cpp +0 -154
  1142. package/interface.js +0 -21
  1143. package/jest-preset.js +0 -26
  1144. package/rn-get-polyfills.js +0 -13
  1145. package/sdks/.hermesversion +0 -1
  1146. package/src/private/components/virtualcollection/debug/FlingItemOverlay.js +0 -13
  1147. package/types/tsconfig.json +0 -15
  1148. /package/ReactCommon/{cxxreact → react/utils}/MoveWrapper.h +0 -0
@@ -1,1949 +0,0 @@
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
-
8
- package com.facebook.react.views.scroll;
9
-
10
- import static com.facebook.react.views.scroll.ReactScrollViewHelper.SNAP_ALIGNMENT_CENTER;
11
- import static com.facebook.react.views.scroll.ReactScrollViewHelper.SNAP_ALIGNMENT_DISABLED;
12
- import static com.facebook.react.views.scroll.ReactScrollViewHelper.SNAP_ALIGNMENT_END;
13
- import static com.facebook.react.views.scroll.ReactScrollViewHelper.SNAP_ALIGNMENT_ITEM;
14
- import static com.facebook.react.views.scroll.ReactScrollViewHelper.SNAP_ALIGNMENT_START;
15
- import static com.facebook.react.views.scroll.ReactScrollViewHelper.findNextFocusableView;
16
-
17
- import android.animation.ObjectAnimator;
18
- import android.animation.ValueAnimator;
19
- import android.content.Context;
20
- import android.graphics.Canvas;
21
- import android.graphics.Color;
22
- import android.graphics.Point;
23
- import android.graphics.Rect;
24
- import android.graphics.drawable.ColorDrawable;
25
- import android.graphics.drawable.Drawable;
26
- import android.os.Build;
27
- import android.view.FocusFinder;
28
- import android.view.KeyEvent;
29
- import android.view.MotionEvent;
30
- import android.view.View;
31
- import android.view.ViewGroup;
32
- import android.view.ViewParent;
33
- import android.view.accessibility.AccessibilityNodeInfo;
34
- import android.widget.HorizontalScrollView;
35
- import android.widget.OverScroller;
36
- import androidx.annotation.Nullable;
37
- import androidx.core.view.ViewCompat;
38
- import androidx.core.view.ViewCompat.FocusDirection;
39
- import com.facebook.common.logging.FLog;
40
- import com.facebook.infer.annotation.Assertions;
41
- import com.facebook.infer.annotation.Nullsafe;
42
- import com.facebook.react.views.common.UiModeUtils;
43
- import com.facebook.react.R;
44
- import com.facebook.react.common.ReactConstants;
45
- import com.facebook.react.common.build.ReactBuildConfig;
46
- import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags;
47
- import com.facebook.react.uimanager.BackgroundStyleApplicator;
48
- import com.facebook.react.uimanager.LengthPercentage;
49
- import com.facebook.react.uimanager.LengthPercentageType;
50
- import com.facebook.react.uimanager.MeasureSpecAssertions;
51
- import com.facebook.react.uimanager.PixelUtil;
52
- import com.facebook.react.uimanager.PointerEvents;
53
- import com.facebook.react.uimanager.ReactClippingViewGroup;
54
- import com.facebook.react.uimanager.ReactClippingViewGroupHelper;
55
- import com.facebook.react.uimanager.ReactOverflowViewWithInset;
56
- import com.facebook.react.uimanager.StateWrapper;
57
- import com.facebook.react.uimanager.events.NativeGestureUtil;
58
- import com.facebook.react.uimanager.style.BorderRadiusProp;
59
- import com.facebook.react.uimanager.style.BorderStyle;
60
- import com.facebook.react.uimanager.style.LogicalEdge;
61
- import com.facebook.react.uimanager.style.Overflow;
62
- import com.facebook.react.views.scroll.ReactScrollViewHelper.HasFlingAnimator;
63
- import com.facebook.react.views.scroll.ReactScrollViewHelper.HasScrollEventThrottle;
64
- import com.facebook.react.views.scroll.ReactScrollViewHelper.HasScrollState;
65
- import com.facebook.react.views.scroll.ReactScrollViewHelper.HasSmoothScroll;
66
- import com.facebook.react.views.scroll.ReactScrollViewHelper.HasStateWrapper;
67
- import com.facebook.react.views.scroll.ReactScrollViewHelper.ReactScrollViewScrollState;
68
- import com.facebook.systrace.Systrace;
69
- import java.lang.reflect.Field;
70
- import java.util.ArrayList;
71
- import java.util.List;
72
- import java.util.Set;
73
-
74
- /** Similar to {@link ReactScrollView} but only supports horizontal scrolling. */
75
- @Nullsafe(Nullsafe.Mode.LOCAL)
76
- public class ReactHorizontalScrollView extends HorizontalScrollView
77
- implements ReactClippingViewGroup,
78
- ViewGroup.OnHierarchyChangeListener,
79
- View.OnLayoutChangeListener,
80
- ReactAccessibleScrollView,
81
- ReactOverflowViewWithInset,
82
- HasScrollState,
83
- HasStateWrapper,
84
- HasFlingAnimator,
85
- HasScrollEventThrottle,
86
- HasSmoothScroll,
87
- VirtualViewContainer {
88
-
89
- private static final boolean DEBUG_MODE = false && ReactBuildConfig.DEBUG;
90
- private static final String TAG = ReactHorizontalScrollView.class.getSimpleName();
91
-
92
- private static final int NO_SCROLL_POSITION = Integer.MIN_VALUE;
93
-
94
- private static @Nullable Field sScrollerField;
95
- private static boolean sTriedToGetScrollerField = false;
96
-
97
- private int mScrollXAfterMeasure = NO_SCROLL_POSITION;
98
-
99
- private static final int UNSET_CONTENT_OFFSET = -1;
100
-
101
- private final OnScrollDispatchHelper mOnScrollDispatchHelper = new OnScrollDispatchHelper();
102
- private final @Nullable OverScroller mScroller;
103
- private final VelocityHelper mVelocityHelper = new VelocityHelper();
104
- private final Rect mTempRect = new Rect();
105
- private final ValueAnimator DEFAULT_FLING_ANIMATOR = ObjectAnimator.ofInt(this, "scrollX", 0, 0);
106
- private final @Nullable FpsListener mFpsListener;
107
-
108
- private Rect mOverflowInset = new Rect();
109
- private @Nullable VirtualViewContainerState mVirtualViewContainerState;
110
- private boolean mActivelyScrolling;
111
- private @Nullable Rect mClippingRect;
112
- private Overflow mOverflow = Overflow.SCROLL;
113
- private boolean mDragging;
114
- private boolean mPagingEnabled = false;
115
- private @Nullable Runnable mPostTouchRunnable;
116
- private boolean mRemoveClippedSubviews;
117
- private boolean mScrollEnabled = true;
118
- private boolean mSendMomentumEvents;
119
- private @Nullable String mScrollPerfTag;
120
- private @Nullable Drawable mEndBackground;
121
- private int mEndFillColor = Color.TRANSPARENT;
122
- private boolean mDisableIntervalMomentum = false;
123
- private int mSnapInterval = 0;
124
- private @Nullable List<Integer> mSnapOffsets;
125
- private boolean mSnapToStart = true;
126
- private boolean mSnapToEnd = true;
127
- private int mSnapToAlignment = SNAP_ALIGNMENT_DISABLED;
128
- private boolean mPagedArrowScrolling = false;
129
- private int mPendingContentOffsetX = UNSET_CONTENT_OFFSET;
130
- private int mPendingContentOffsetY = UNSET_CONTENT_OFFSET;
131
- private @Nullable StateWrapper mStateWrapper = null;
132
- private ReactScrollViewScrollState mReactScrollViewScrollState;
133
- private PointerEvents mPointerEvents = PointerEvents.AUTO;
134
- private long mLastScrollDispatchTime = 0;
135
- private int mScrollEventThrottle = 0;
136
- private @Nullable View mContentView;
137
- private @Nullable MaintainVisibleScrollPositionHelper mMaintainVisibleContentPositionHelper;
138
- private int mFadingEdgeLengthStart = 0;
139
- private int mFadingEdgeLengthEnd = 0;
140
- private boolean mEmittedOverScrollSinceScrollBegin = false;
141
- private boolean mScrollsChildToFocus = true;
142
- private int mSnapToItemPadding;
143
- private boolean mScrollAnimationEnabled = true;
144
- private boolean mBlockScrollDelta = false;
145
-
146
- public ReactHorizontalScrollView(Context context) {
147
- this(context, null);
148
- }
149
-
150
- public ReactHorizontalScrollView(Context context, @Nullable FpsListener fpsListener) {
151
- super(context);
152
- mFpsListener = fpsListener;
153
-
154
- ViewCompat.setAccessibilityDelegate(this, new ReactScrollViewAccessibilityDelegate());
155
-
156
- mScroller = getOverScrollerFromParent();
157
-
158
- setOnHierarchyChangeListener(this);
159
- setClipChildren(false);
160
- initView();
161
- }
162
-
163
- /**
164
- * Set all default values here as opposed to in the constructor or field defaults. It is important
165
- * that these properties are set during the constructor, but also on-demand whenever an existing
166
- * ReactHorizontalScrollView is recycled.
167
- */
168
- private void initView() {
169
- mOverflowInset = new Rect();
170
- mVirtualViewContainerState = null;
171
- mActivelyScrolling = false;
172
- mClippingRect = null;
173
- // The default value for `overflow` is set to `Visible` in the Yoga style props.
174
- mOverflow =
175
- ReactNativeFeatureFlags.enablePropsUpdateReconciliationAndroid()
176
- ? Overflow.VISIBLE
177
- : Overflow.SCROLL;
178
-
179
- mDragging = false;
180
- mPagingEnabled = false;
181
- mPostTouchRunnable = null;
182
- mRemoveClippedSubviews = false;
183
- mScrollEnabled = true;
184
- mSendMomentumEvents = false;
185
- mScrollPerfTag = null;
186
- mEndBackground = null;
187
- mEndFillColor = Color.TRANSPARENT;
188
- mDisableIntervalMomentum = false;
189
- mSnapInterval = 0;
190
- mSnapOffsets = null;
191
- mSnapToStart = true;
192
- mSnapToEnd = true;
193
- mSnapToAlignment = SNAP_ALIGNMENT_DISABLED;
194
- mPagedArrowScrolling = false;
195
- mPendingContentOffsetX = UNSET_CONTENT_OFFSET;
196
- mPendingContentOffsetY = UNSET_CONTENT_OFFSET;
197
- mStateWrapper = null;
198
- mReactScrollViewScrollState = new ReactScrollViewScrollState();
199
-
200
- mPointerEvents = PointerEvents.AUTO;
201
- mLastScrollDispatchTime = 0;
202
- mScrollEventThrottle = 0;
203
- mContentView = null;
204
- mMaintainVisibleContentPositionHelper = null;
205
- mFadingEdgeLengthStart = 0;
206
- mFadingEdgeLengthEnd = 0;
207
- mScrollsChildToFocus = true;
208
- }
209
-
210
- /* package */ void recycleView() {
211
- // Set default field values
212
- initView();
213
-
214
- // If the view is still attached to a parent, we need to remove it from the parent
215
- // before we can recycle it.
216
- if (getParent() != null) {
217
- ((ViewGroup) getParent()).removeView(this);
218
- }
219
- updateView();
220
- }
221
-
222
- private void updateView() {}
223
-
224
- @Override
225
- public VirtualViewContainerState getVirtualViewContainerState() {
226
- if (mVirtualViewContainerState == null) {
227
- mVirtualViewContainerState = VirtualViewContainerState.create(this);
228
- }
229
-
230
- return mVirtualViewContainerState;
231
- }
232
-
233
- @Override
234
- public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
235
- super.onInitializeAccessibilityNodeInfo(info);
236
-
237
- // Expose the testID prop as the resource-id name of the view. Black-box E2E/UI testing
238
- // frameworks, which interact with the UI through the accessibility framework, do not have
239
- // access to view tags. This allows developers/testers to avoid polluting the
240
- // content-description with test identifiers.
241
- final String testId = (String) this.getTag(R.id.react_test_id);
242
- if (testId != null) {
243
- info.setViewIdResourceName(testId);
244
- }
245
- }
246
-
247
- @Override
248
- public boolean getScrollEnabled() {
249
- return mScrollEnabled;
250
- }
251
-
252
- @Override
253
- public boolean canScrollHorizontally(int direction) {
254
- return mScrollEnabled && super.canScrollHorizontally(direction);
255
- }
256
-
257
- @Override
258
- public void computeScroll() {
259
- if (UiModeUtils.isTVDevice(getContext())
260
- && !mScrollAnimationEnabled
261
- && mScroller != null
262
- && !mScroller.isFinished()) {
263
- // Jump instantly to the target position instead of animating.
264
- scrollTo(mScroller.getFinalX(), mScroller.getFinalY());
265
- mScroller.forceFinished(true);
266
- return;
267
- }
268
- super.computeScroll();
269
- }
270
-
271
- @Override
272
- protected int computeScrollDeltaToGetChildRectOnScreen(Rect rect) {
273
- if (!mScrollEnabled || mBlockScrollDelta) {
274
- return 0;
275
- }
276
- return super.computeScrollDeltaToGetChildRectOnScreen(rect);
277
- }
278
-
279
- @Nullable
280
- private OverScroller getOverScrollerFromParent() {
281
- OverScroller scroller;
282
-
283
- if (!sTriedToGetScrollerField) {
284
- sTriedToGetScrollerField = true;
285
- try {
286
- sScrollerField = HorizontalScrollView.class.getDeclaredField("mScroller");
287
- sScrollerField.setAccessible(true);
288
- } catch (NoSuchFieldException e) {
289
- FLog.w(
290
- TAG,
291
- "Failed to get mScroller field for HorizontalScrollView! "
292
- + "This app will exhibit the bounce-back scrolling bug :(");
293
- }
294
- }
295
-
296
- if (sScrollerField != null) {
297
- try {
298
- Object scrollerValue = sScrollerField.get(this);
299
- if (scrollerValue instanceof OverScroller) {
300
- scroller = (OverScroller) scrollerValue;
301
- } else {
302
- FLog.w(
303
- TAG,
304
- "Failed to cast mScroller field in HorizontalScrollView (probably due to OEM changes"
305
- + " to AOSP)! This app will exhibit the bounce-back scrolling bug :(");
306
- scroller = null;
307
- }
308
- } catch (IllegalAccessException e) {
309
- throw new RuntimeException("Failed to get mScroller from HorizontalScrollView!", e);
310
- }
311
- } else {
312
- scroller = null;
313
- }
314
-
315
- return scroller;
316
- }
317
-
318
- public void setScrollPerfTag(@Nullable String scrollPerfTag) {
319
- mScrollPerfTag = scrollPerfTag;
320
- }
321
-
322
- @Override
323
- public void setRemoveClippedSubviews(boolean removeClippedSubviews) {
324
- if (ReactNativeFeatureFlags.disableSubviewClippingAndroid()) {
325
- return;
326
- }
327
-
328
- if (removeClippedSubviews && mClippingRect == null) {
329
- mClippingRect = new Rect();
330
- }
331
- mRemoveClippedSubviews = removeClippedSubviews;
332
- updateClippingRect();
333
- }
334
-
335
- @Override
336
- public boolean getRemoveClippedSubviews() {
337
- return mRemoveClippedSubviews;
338
- }
339
-
340
- public void setDisableIntervalMomentum(boolean disableIntervalMomentum) {
341
- mDisableIntervalMomentum = disableIntervalMomentum;
342
- }
343
-
344
- public void setSendMomentumEvents(boolean sendMomentumEvents) {
345
- mSendMomentumEvents = sendMomentumEvents;
346
- }
347
-
348
- public void setScrollEnabled(boolean scrollEnabled) {
349
- mScrollEnabled = scrollEnabled;
350
- }
351
-
352
- public void setPagingEnabled(boolean pagingEnabled) {
353
- mPagingEnabled = pagingEnabled;
354
- }
355
-
356
- public void setScrollsChildToFocus(boolean scrollsChildToFocus) {
357
- mScrollsChildToFocus = scrollsChildToFocus;
358
- }
359
-
360
- public void setDecelerationRate(float decelerationRate) {
361
- getReactScrollViewScrollState().setDecelerationRate(decelerationRate);
362
-
363
- if (mScroller != null) {
364
- mScroller.setFriction(1.0f - decelerationRate);
365
- }
366
- }
367
-
368
- public void abortAnimation() {
369
- if (mScroller != null && !mScroller.isFinished()) {
370
- mScroller.abortAnimation();
371
- }
372
- }
373
-
374
- public void setSnapInterval(int snapInterval) {
375
- mSnapInterval = snapInterval;
376
- }
377
-
378
- public void setSnapOffsets(@Nullable List<Integer> snapOffsets) {
379
- mSnapOffsets = snapOffsets;
380
- }
381
-
382
- public void setSnapToStart(boolean snapToStart) {
383
- mSnapToStart = snapToStart;
384
- }
385
-
386
- public void setSnapToEnd(boolean snapToEnd) {
387
- mSnapToEnd = snapToEnd;
388
- }
389
-
390
- public void setSnapToAlignment(int snapToAlignment) {
391
- mSnapToAlignment = snapToAlignment;
392
- }
393
-
394
- public void flashScrollIndicators() {
395
- awakenScrollBars();
396
- }
397
-
398
- public int getFadingEdgeLengthStart() {
399
- return mFadingEdgeLengthStart;
400
- }
401
-
402
- public int getFadingEdgeLengthEnd() {
403
- return mFadingEdgeLengthEnd;
404
- }
405
-
406
- public void setFadingEdgeLengthStart(int start) {
407
- mFadingEdgeLengthStart = start;
408
- invalidate();
409
- }
410
-
411
- public void setFadingEdgeLengthEnd(int end) {
412
- mFadingEdgeLengthEnd = end;
413
- invalidate();
414
- }
415
-
416
- public void setSnapToItemPadding(int snapToItemPadding) {
417
- mSnapToItemPadding = snapToItemPadding;
418
- }
419
-
420
- public void setScrollAnimationEnabled(boolean scrollAnimationEnabled) {
421
- mScrollAnimationEnabled = scrollAnimationEnabled;
422
- }
423
-
424
- @Override
425
- protected float getLeftFadingEdgeStrength() {
426
- float max = Math.max(mFadingEdgeLengthStart, mFadingEdgeLengthEnd);
427
- int value =
428
- getLayoutDirection() == LAYOUT_DIRECTION_RTL
429
- ? mFadingEdgeLengthEnd
430
- : mFadingEdgeLengthStart;
431
- return (value / max);
432
- }
433
-
434
- @Override
435
- protected float getRightFadingEdgeStrength() {
436
- float max = Math.max(mFadingEdgeLengthStart, mFadingEdgeLengthEnd);
437
- int value =
438
- getLayoutDirection() == LAYOUT_DIRECTION_RTL
439
- ? mFadingEdgeLengthStart
440
- : mFadingEdgeLengthEnd;
441
- return (value / max);
442
- }
443
-
444
- public void setOverflow(@Nullable String overflow) {
445
- if (overflow == null) {
446
- mOverflow = Overflow.SCROLL;
447
- } else {
448
- @Nullable Overflow parsedOverflow = Overflow.fromString(overflow);
449
- mOverflow =
450
- parsedOverflow == null
451
- ? (ReactNativeFeatureFlags.enablePropsUpdateReconciliationAndroid()
452
- ? Overflow.VISIBLE
453
- : Overflow.SCROLL)
454
- : parsedOverflow;
455
- }
456
-
457
- invalidate();
458
- }
459
-
460
- public void setMaintainVisibleContentPosition(
461
- @Nullable MaintainVisibleScrollPositionHelper.Config config) {
462
- if (config != null && mMaintainVisibleContentPositionHelper == null) {
463
- mMaintainVisibleContentPositionHelper = new MaintainVisibleScrollPositionHelper(this, true);
464
- mMaintainVisibleContentPositionHelper.start();
465
- } else if (config == null && mMaintainVisibleContentPositionHelper != null) {
466
- mMaintainVisibleContentPositionHelper.stop();
467
- mMaintainVisibleContentPositionHelper = null;
468
- }
469
- if (mMaintainVisibleContentPositionHelper != null) {
470
- mMaintainVisibleContentPositionHelper.setConfig(config);
471
- }
472
- }
473
-
474
- @Override
475
- public @Nullable String getOverflow() {
476
- switch (mOverflow) {
477
- case HIDDEN:
478
- return "hidden";
479
- case SCROLL:
480
- return "scroll";
481
- case VISIBLE:
482
- return "visible";
483
- }
484
-
485
- return null;
486
- }
487
-
488
- @Override
489
- public void setOverflowInset(int left, int top, int right, int bottom) {
490
- mOverflowInset.set(left, top, right, bottom);
491
- }
492
-
493
- @Override
494
- public Rect getOverflowInset() {
495
- return mOverflowInset;
496
- }
497
-
498
- @Override
499
- public void onDraw(Canvas canvas) {
500
- if (mOverflow != Overflow.VISIBLE) {
501
- BackgroundStyleApplicator.clipToPaddingBox(this, canvas);
502
- }
503
- super.onDraw(canvas);
504
- }
505
-
506
- @Override
507
- protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
508
- MeasureSpecAssertions.assertExplicitMeasureSpec(widthMeasureSpec, heightMeasureSpec);
509
-
510
- int measuredWidth = MeasureSpec.getSize(widthMeasureSpec);
511
- int measuredHeight = MeasureSpec.getSize(heightMeasureSpec);
512
-
513
- if (DEBUG_MODE) {
514
- FLog.i(
515
- TAG,
516
- "onMeasure[%d] measured width: %d measured height: %d",
517
- getId(),
518
- measuredWidth,
519
- measuredHeight);
520
- }
521
-
522
- boolean measuredHeightChanged = getMeasuredHeight() != measuredHeight;
523
-
524
- setMeasuredDimension(measuredWidth, measuredHeight);
525
-
526
- // See how `mScrollXAfterMeasure` is used in `onLayout`, and why we only enable the
527
- // hack if the height has changed.
528
- if (measuredHeightChanged && mScroller != null) {
529
- mScrollXAfterMeasure = mScroller.getCurrX();
530
- }
531
- }
532
-
533
- @Override
534
- protected void onLayout(boolean changed, int l, int t, int r, int b) {
535
- if (DEBUG_MODE) {
536
- FLog.i(TAG, "onLayout[%d] l %d t %d r %d b %d", getId(), l, t, r, b);
537
- }
538
-
539
- // Has the scrollX changed between the last onMeasure and this layout?
540
- // If so, cancel the animation.
541
- // Essentially, if the height changes (due to keyboard popping up, for instance) the
542
- // underlying View.layout method will in some cases scroll to an incorrect X position -
543
- // see also the hacks in `fling`. The order of layout is called in the order of: onMeasure,
544
- // layout, onLayout.
545
- // We cannot override `layout` but we can detect the sequence of events between onMeasure
546
- // and onLayout.
547
- if (mScrollXAfterMeasure != NO_SCROLL_POSITION
548
- && mScroller != null
549
- && mScrollXAfterMeasure != mScroller.getFinalX()
550
- && !mScroller.isFinished()) {
551
- if (DEBUG_MODE) {
552
- FLog.i(
553
- TAG,
554
- "onLayout[%d] scroll hack enabled: reset to previous scrollX position of %d",
555
- getId(),
556
- mScrollXAfterMeasure);
557
- }
558
- mScroller.startScroll(mScrollXAfterMeasure, mScroller.getFinalY(), 0, 0);
559
- mScroller.forceFinished(true);
560
- mScrollXAfterMeasure = NO_SCROLL_POSITION;
561
- }
562
-
563
- // Apply pending contentOffset in case it was set before the view was laid out.
564
- if (isContentReady()) {
565
- // If a "pending" content offset value has been set, we restore that value.
566
- // Upon call to scrollTo, the "pending" values will be re-set.
567
- int scrollToX =
568
- mPendingContentOffsetX != UNSET_CONTENT_OFFSET ? mPendingContentOffsetX : getScrollX();
569
- int scrollToY =
570
- mPendingContentOffsetY != UNSET_CONTENT_OFFSET ? mPendingContentOffsetY : getScrollY();
571
- scrollTo(scrollToX, scrollToY);
572
- }
573
-
574
- ReactScrollViewHelper.emitLayoutEvent(this);
575
- if (mVirtualViewContainerState != null) {
576
- mVirtualViewContainerState.updateState();
577
- }
578
- }
579
-
580
- /**
581
- * Attempts to scroll-snap to the focused child based on snapToAlignment/scrollSnapAlign
582
- * or scrollSnapOffset. Returns true if snap scrolling was performed, false otherwise.
583
- */
584
- private boolean tryScrollSnapToChild(View focused) {
585
- if (mSnapToAlignment != SNAP_ALIGNMENT_ITEM) {
586
- return false;
587
- }
588
-
589
- kotlin.Triple<View, String, Integer> result =
590
- ReactScrollViewHelper.findScrollSnap(focused, this);
591
- if (result == null) {
592
- return false;
593
- }
594
-
595
- View snapTarget = result.getFirst();
596
- String alignment = result.getSecond();
597
- Integer snapOffset = result.getThird();
598
-
599
- Rect rect = new Rect();
600
- snapTarget.getDrawingRect(rect);
601
- offsetDescendantRectToMyCoords(snapTarget, rect);
602
-
603
- int maxScrollX = Math.max(0, computeHorizontalScrollRange() - getWidth());
604
-
605
- if (snapOffset != null) {
606
- int targetOffset = ReactScrollViewHelper.computeScrollSnapTargetForOffset(
607
- rect.left, snapOffset, mSnapInterval, maxScrollX);
608
- reactSmoothScrollTo(targetOffset, getScrollY());
609
- return true;
610
- }
611
-
612
- int viewportWidth = getWidth() - getPaddingLeft() - getPaddingRight();
613
-
614
- Integer targetOffset = ReactScrollViewHelper.computeScrollSnapOffset(
615
- rect.left, rect.right, viewportWidth, alignment, mSnapInterval, mSnapToItemPadding, maxScrollX);
616
- if (targetOffset == null) {
617
- return false;
618
- }
619
-
620
- reactSmoothScrollTo(targetOffset, getScrollY());
621
- return true;
622
- }
623
-
624
- /**
625
- * Since ReactHorizontalScrollView handles layout changes on JS side, it does not call
626
- * super.onLayout due to which mIsLayoutDirty flag in HorizontalScrollView remains true and
627
- * prevents scrolling to child when requestChildFocus is called. Overriding this method and
628
- * scrolling to child without checking any layout dirty flag. This will fix focus navigation issue
629
- * for KeyEvents which are not handled in HorizontalScrollView, for example: KEYCODE_TAB.
630
- */
631
- @Override
632
- public void requestChildFocus(View child, View focused) {
633
- if (focused != null && mScrollsChildToFocus) {
634
- if (!tryScrollSnapToChild(focused)) {
635
- if (!mPagingEnabled) {
636
- scrollToChild(focused);
637
- }
638
- }
639
- }
640
- requestChildFocusWithoutScroll(child, focused);
641
- }
642
-
643
- /**
644
- * In rare cases where an app overrides the built-in ReactScrollView by overriding it, and also
645
- * needs to customize scroll into view on focus behaviors, this protected method can be used to
646
- * unblock such customization.
647
- */
648
- protected void requestChildFocusWithoutScroll(View child, View focused) {
649
- // Temporarily block HorizontalScrollView's internal scrollToChild from running
650
- // during super.requestChildFocus — we've already handled scrolling in requestChildFocus.
651
- mBlockScrollDelta = true;
652
- super.requestChildFocus(child, focused);
653
- mBlockScrollDelta = false;
654
- }
655
-
656
- @Override
657
- public boolean requestChildRectangleOnScreen(View child, Rect rectangle, boolean immediate) {
658
- if (!mScrollsChildToFocus) {
659
- return false;
660
- }
661
- return super.requestChildRectangleOnScreen(child, rectangle, immediate);
662
- }
663
-
664
- @Override
665
- public void addFocusables(ArrayList<View> views, int direction, int focusableMode) {
666
- if (mPagingEnabled && !mPagedArrowScrolling) {
667
- // Only add elements within the current page to list of focusables
668
- ArrayList<View> candidateViews = new ArrayList<View>();
669
- super.addFocusables(candidateViews, direction, focusableMode);
670
- for (View candidate : candidateViews) {
671
- // We must also include the currently focused in the focusables list or focus search will
672
- // always
673
- // return the first element within the focusables list
674
- if (isScrolledInView(candidate)
675
- || isPartiallyScrolledInView(candidate)
676
- || candidate.isFocused()) {
677
- views.add(candidate);
678
- }
679
- }
680
- } else {
681
- super.addFocusables(views, direction, focusableMode);
682
- }
683
- }
684
-
685
- /** Calculates the x delta required to scroll the given descendent into view */
686
- private int getScrollDelta(View descendent) {
687
- descendent.getDrawingRect(mTempRect);
688
- offsetDescendantRectToMyCoords(descendent, mTempRect);
689
- return computeScrollDeltaToGetChildRectOnScreen(mTempRect);
690
- }
691
-
692
- /** Returns whether the given descendent is scrolled fully in view */
693
- private boolean isScrolledInView(View descendent) {
694
- return getScrollDelta(descendent) == 0;
695
- }
696
-
697
- /** Returns whether the given descendent is partially scrolled in view */
698
- @Override
699
- public boolean isPartiallyScrolledInView(View descendent) {
700
- int scrollDelta = getScrollDelta(descendent);
701
- descendent.getDrawingRect(mTempRect);
702
- return scrollDelta != 0 && Math.abs(scrollDelta) < mTempRect.width();
703
- }
704
-
705
- /** Returns whether the given descendent is "mostly" (>50%) scrolled in view */
706
- private boolean isMostlyScrolledInView(View descendent) {
707
- int scrollDelta = getScrollDelta(descendent);
708
- descendent.getDrawingRect(mTempRect);
709
- return scrollDelta != 0 && Math.abs(scrollDelta) < (mTempRect.width() / 2);
710
- }
711
-
712
- private void scrollToChild(View child) {
713
- int scrollDelta = getScrollDelta(child);
714
-
715
- if (scrollDelta != 0) {
716
- scrollBy(scrollDelta, 0);
717
- }
718
- }
719
-
720
- @Override
721
- protected void onScrollChanged(int x, int y, int oldX, int oldY) {
722
- if (DEBUG_MODE) {
723
- FLog.i(TAG, "onScrollChanged[%d] x %d y %d oldx %d oldy %d", getId(), x, y, oldX, oldY);
724
- }
725
-
726
- Systrace.beginSection(Systrace.TRACE_TAG_REACT, "ReactHorizontalScrollView.onScrollChanged");
727
- try {
728
- super.onScrollChanged(x, y, oldX, oldY);
729
-
730
- mActivelyScrolling = true;
731
-
732
- if (mOnScrollDispatchHelper.onScrollChanged(x, y)) {
733
- if (mRemoveClippedSubviews) {
734
- updateClippingRect();
735
- }
736
- ReactScrollViewHelper.updateStateOnScrollChanged(
737
- this,
738
- mOnScrollDispatchHelper.getXFlingVelocity(),
739
- mOnScrollDispatchHelper.getYFlingVelocity());
740
- if (mVirtualViewContainerState != null) {
741
- mVirtualViewContainerState.updateState();
742
- }
743
- }
744
-
745
- } finally {
746
- Systrace.endSection(Systrace.TRACE_TAG_REACT);
747
- }
748
- }
749
-
750
- @Nullable
751
- private static HorizontalScrollView findDeepestScrollViewForMotionEvent(
752
- View view, MotionEvent ev) {
753
- return findDeepestScrollViewForMotionEvent(view, ev, true);
754
- }
755
-
756
- @Nullable
757
- private static HorizontalScrollView findDeepestScrollViewForMotionEvent(
758
- View view, MotionEvent ev, boolean skipInitialView) {
759
- if (view == null) {
760
- return null;
761
- }
762
-
763
- Rect rectOnScreen = new Rect();
764
- view.getGlobalVisibleRect(rectOnScreen);
765
- if (!rectOnScreen.contains((int) ev.getRawX(), (int) ev.getRawY())) {
766
- return null;
767
- }
768
-
769
- // Only consider the current view if it's not the initial view. We check the
770
- // current view first to bail out of recursion. Essentially if there's any
771
- // nested horizontal scrollview with nested scrolling enabled, the parent
772
- // scroll view shouldn't pick up the down event.
773
- if (!skipInitialView
774
- && view instanceof HorizontalScrollView
775
- && ViewCompat.isNestedScrollingEnabled(view)
776
- && (view instanceof ReactHorizontalScrollView
777
- && ((ReactHorizontalScrollView) view).mScrollEnabled)) {
778
- return (HorizontalScrollView) view;
779
- }
780
-
781
- // First, check child views recursively before considering this view.
782
- if (view instanceof ViewGroup) {
783
- for (int i = 0; i < ((ViewGroup) view).getChildCount(); i++) {
784
- HorizontalScrollView foundScrollView =
785
- findDeepestScrollViewForMotionEvent(((ViewGroup) view).getChildAt(i), ev, false);
786
-
787
- if (foundScrollView != null) {
788
- // If a deeper HorizontalScrollView is found in child views, return it.
789
- return foundScrollView;
790
- }
791
- }
792
- }
793
-
794
- // Return null if no matching view is found.
795
- return null;
796
- }
797
-
798
- @Override
799
- public boolean onInterceptTouchEvent(MotionEvent ev) {
800
- if (!mScrollEnabled) {
801
- return false;
802
- }
803
-
804
- if ((ev.getAction() == MotionEvent.ACTION_DOWN)
805
- && findDeepestScrollViewForMotionEvent(this, ev) != null) {
806
- return false;
807
- }
808
-
809
- // We intercept the touch event if the children are not supposed to receive it.
810
- if (!PointerEvents.canChildrenBeTouchTarget(mPointerEvents)) {
811
- return true;
812
- }
813
-
814
- try {
815
- if (super.onInterceptTouchEvent(ev)) {
816
- handleInterceptedTouchEvent(ev);
817
- return true;
818
- }
819
- } catch (IllegalArgumentException e) {
820
- // Log and ignore the error. This seems to be a bug in the android SDK and
821
- // this is the commonly accepted workaround.
822
- // https://tinyurl.com/mw6qkod (Stack Overflow)
823
- FLog.w(ReactConstants.TAG, "Error intercepting touch event.", e);
824
- }
825
-
826
- return false;
827
- }
828
-
829
- protected void handleInterceptedTouchEvent(MotionEvent ev) {
830
- if (!ReactNativeFeatureFlags.shouldTriggerResponderTransferOnScrollAndroid()) {
831
- NativeGestureUtil.notifyNativeGestureStarted(this, ev);
832
- }
833
- ReactScrollViewHelper.emitScrollBeginDragEvent(this);
834
- mDragging = true;
835
- mEmittedOverScrollSinceScrollBegin = false;
836
- enableFpsListener();
837
- getFlingAnimator().cancel();
838
- }
839
-
840
- @Override
841
- public boolean pageScroll(int direction) {
842
- boolean handled = super.pageScroll(direction);
843
-
844
- if (mPagingEnabled && handled) {
845
- handlePostTouchScrolling(0, 0);
846
- }
847
-
848
- return handled;
849
- }
850
-
851
- private boolean isDescendantOf(View parent, View view) {
852
- if (view == null || parent == null) {
853
- return false;
854
- }
855
- ViewParent p = view.getParent();
856
- while (p != null && p.getParent() != null) {
857
- if (p == parent) {
858
- return true;
859
- }
860
- p = p.getParent();
861
- }
862
- return false;
863
- }
864
-
865
- @Override
866
- public boolean arrowScroll(int direction) {
867
- boolean handled = false;
868
-
869
- if (mSnapToAlignment == SNAP_ALIGNMENT_ITEM) {
870
- // When snapToAlignment is "item", find the next focusable and request focus directly.
871
- // This avoids super.arrowScroll() which starts its own scroll animation that conflicts
872
- // with tryScrollSnapToChild's snap scrolling.
873
- // requestChildFocus → tryScrollSnapToChild handles scrolling.
874
- View currentFocused = findFocus();
875
- View nextFocused = FocusFinder.getInstance().findNextFocus(this, currentFocused, direction);
876
- if (nextFocused != null && nextFocused != currentFocused && nextFocused != this) {
877
- nextFocused.requestFocus(direction);
878
- handled = true;
879
- }
880
- } else if (mPagingEnabled) {
881
- mPagedArrowScrolling = true;
882
-
883
- if (getChildCount() > 0) {
884
- View currentFocused = findFocus();
885
- View nextFocused = FocusFinder.getInstance().findNextFocus(this, currentFocused, direction);
886
- View rootChild = getContentView();
887
- if (rootChild != null && nextFocused != null && isDescendantOf(rootChild, nextFocused)) {
888
- if (mSnapToAlignment == SNAP_ALIGNMENT_ITEM) {
889
- // When snapToAlignment is "item", don't use smoothScrollToNextPage (which scrolls
890
- // by full page width and ignores snapToItemPadding). Instead just request focus —
891
- // requestChildFocus → tryScrollSnapToChild handles scrolling with correct padding.
892
- nextFocused.requestFocus();
893
- } else {
894
- if (!isScrolledInView(nextFocused) && !isMostlyScrolledInView(nextFocused)) {
895
- smoothScrollToNextPage(direction);
896
- }
897
- nextFocused.requestFocus();
898
- }
899
- handled = true;
900
- } else {
901
- if (mSnapToAlignment != SNAP_ALIGNMENT_ITEM) {
902
- smoothScrollToNextPage(direction);
903
- }
904
- handled = true;
905
- }
906
- }
907
-
908
- mPagedArrowScrolling = false;
909
- } else {
910
- handled = super.arrowScroll(direction);
911
- }
912
-
913
- return handled;
914
- }
915
-
916
- @Override
917
- public boolean onTouchEvent(MotionEvent ev) {
918
- if (!mScrollEnabled) {
919
- return false;
920
- }
921
-
922
- // We do not accept the touch event if this view is not supposed to receive it.
923
- if (!PointerEvents.canBeTouchTarget(mPointerEvents)) {
924
- return false;
925
- }
926
-
927
- mVelocityHelper.calculateVelocity(ev);
928
- int action = ev.getActionMasked();
929
- if (action == MotionEvent.ACTION_UP && mDragging) {
930
- ReactScrollViewHelper.updateFabricScrollState(this);
931
-
932
- float velocityX = mVelocityHelper.getXVelocity();
933
- float velocityY = mVelocityHelper.getYVelocity();
934
- ReactScrollViewHelper.emitScrollEndDragEvent(this, velocityX, velocityY);
935
- if (!ReactNativeFeatureFlags.shouldTriggerResponderTransferOnScrollAndroid()) {
936
- NativeGestureUtil.notifyNativeGestureEnded(this, ev);
937
- }
938
- mDragging = false;
939
- // After the touch finishes, we may need to do some scrolling afterwards either as a result
940
- // of a fling or because we need to page align the content
941
- handlePostTouchScrolling(Math.round(velocityX), Math.round(velocityY));
942
- }
943
-
944
- if (action == MotionEvent.ACTION_DOWN) {
945
- cancelPostTouchScrolling();
946
- }
947
-
948
- return super.onTouchEvent(ev);
949
- }
950
-
951
- @Override
952
- public boolean dispatchGenericMotionEvent(MotionEvent ev) {
953
- // Ignore generic motion events (joystick, mouse wheel, trackpad) if scrolling is disabled
954
- if (!mScrollEnabled) {
955
- return false;
956
- }
957
-
958
- // We do not dispatch the motion event if its children are not supposed to receive it
959
- if (!PointerEvents.canChildrenBeTouchTarget(mPointerEvents)) {
960
- return false;
961
- }
962
-
963
- // Handle ACTION_SCROLL events (mouse wheel, trackpad, joystick)
964
- if (ev.getActionMasked() == MotionEvent.ACTION_SCROLL) {
965
- float hScroll = ev.getAxisValue(MotionEvent.AXIS_HSCROLL);
966
- if (hScroll != 0) {
967
- // Perform the scroll
968
- enableFpsListener();
969
- boolean result = super.dispatchGenericMotionEvent(ev);
970
- // Schedule snap alignment to run after scrolling stops
971
- if (result
972
- && (mPagingEnabled
973
- || mSnapInterval != 0
974
- || mSnapOffsets != null
975
- || (mSnapToAlignment != SNAP_ALIGNMENT_DISABLED && mSnapToAlignment != SNAP_ALIGNMENT_ITEM))) {
976
- // Cancel any pending post-touch runnable and reschedule
977
- if (mPostTouchRunnable != null) {
978
- removeCallbacks(mPostTouchRunnable);
979
- mPostTouchRunnable = null;
980
- }
981
- mPostTouchRunnable =
982
- new Runnable() {
983
- @Override
984
- public void run() {
985
- mPostTouchRunnable = null;
986
- // +1/-1 velocity if scrolling right or left. This is to ensure that the
987
- // next/previous page is picked rather than sliding backwards to the current page
988
- int velocityX = (int) Math.signum(hScroll);
989
- if (mDisableIntervalMomentum) {
990
- velocityX = 0;
991
- }
992
- flingAndSnap(velocityX);
993
- handlePostTouchScrolling(velocityX, 0);
994
- }
995
- };
996
- postOnAnimationDelayed(mPostTouchRunnable, ReactScrollViewHelper.MOMENTUM_DELAY);
997
- } else {
998
- handlePostTouchScrolling(0, 0);
999
- }
1000
- return result;
1001
- }
1002
- }
1003
-
1004
- return super.dispatchGenericMotionEvent(ev);
1005
- }
1006
-
1007
- @Override
1008
- public boolean executeKeyEvent(KeyEvent event) {
1009
- int eventKeyCode = event.getKeyCode();
1010
- if (!mScrollEnabled
1011
- && (eventKeyCode == KeyEvent.KEYCODE_DPAD_LEFT
1012
- || eventKeyCode == KeyEvent.KEYCODE_DPAD_RIGHT)) {
1013
- return false;
1014
- }
1015
- return super.executeKeyEvent(event);
1016
- }
1017
-
1018
- @Override
1019
- public void fling(int velocityX) {
1020
- if (DEBUG_MODE) {
1021
- FLog.i(TAG, "fling[%d] velocityX %d", getId(), velocityX);
1022
- }
1023
-
1024
- // Workaround.
1025
- // On Android P if a ScrollView is inverted, we will get a wrong sign for
1026
- // velocityX (see https://issuetracker.google.com/issues/112385925).
1027
- // At the same time, mOnScrollDispatchHelper tracks the correct velocity direction.
1028
- //
1029
- // Hence, we can use the absolute value from whatever the OS gives
1030
- // us and use the sign of what mOnScrollDispatchHelper has tracked.
1031
- final int correctedVelocityX =
1032
- Build.VERSION.SDK_INT == Build.VERSION_CODES.P
1033
- ? (int) (Math.abs(velocityX) * Math.signum(mOnScrollDispatchHelper.getXFlingVelocity()))
1034
- : velocityX;
1035
-
1036
- if (mPagingEnabled) {
1037
- flingAndSnap(correctedVelocityX);
1038
- } else if (mScroller != null) {
1039
- // FB SCROLLVIEW CHANGE
1040
-
1041
- // We provide our own version of fling that uses a different call to the standard OverScroller
1042
- // which takes into account the possibility of adding new content while the ScrollView is
1043
- // animating. Because we give essentially no max X for the fling, the fling will continue as
1044
- // long
1045
- // as there is content. See #onOverScrolled() to see the second part of this change which
1046
- // properly
1047
- // aborts the scroller animation when we get to the bottom of the ScrollView content.
1048
-
1049
- int scrollWindowWidth =
1050
- getWidth() - ViewCompat.getPaddingStart(this) - ViewCompat.getPaddingEnd(this);
1051
-
1052
- mScroller.fling(
1053
- getScrollX(), // startX
1054
- getScrollY(), // startY
1055
- correctedVelocityX, // velocityX
1056
- 0, // velocityY
1057
- 0, // minX
1058
- Integer.MAX_VALUE, // maxX
1059
- 0, // minY
1060
- 0, // maxY
1061
- scrollWindowWidth / 2, // overX
1062
- 0 // overY
1063
- );
1064
-
1065
- ViewCompat.postInvalidateOnAnimation(this);
1066
-
1067
- // END FB SCROLLVIEW CHANGE
1068
- } else {
1069
- super.fling(correctedVelocityX);
1070
- }
1071
- handlePostTouchScrolling(correctedVelocityX, 0);
1072
- }
1073
-
1074
- @Override
1075
- protected void onSizeChanged(int w, int h, int oldw, int oldh) {
1076
- super.onSizeChanged(w, h, oldw, oldh);
1077
- if (mRemoveClippedSubviews) {
1078
- updateClippingRect();
1079
- }
1080
- if (mVirtualViewContainerState != null) {
1081
- mVirtualViewContainerState.updateState();
1082
- }
1083
- }
1084
-
1085
- @Override
1086
- protected void onAttachedToWindow() {
1087
- super.onAttachedToWindow();
1088
- if (mRemoveClippedSubviews) {
1089
- updateClippingRect();
1090
- }
1091
- if (mMaintainVisibleContentPositionHelper != null) {
1092
- mMaintainVisibleContentPositionHelper.start();
1093
- }
1094
- }
1095
-
1096
- @Override
1097
- protected void onDetachedFromWindow() {
1098
- super.onDetachedFromWindow();
1099
- if (mMaintainVisibleContentPositionHelper != null) {
1100
- mMaintainVisibleContentPositionHelper.stop();
1101
- }
1102
- }
1103
-
1104
- @Override
1105
- public @Nullable View focusSearch(View focused, @FocusDirection int direction) {
1106
- View nextFocus = super.focusSearch(focused, direction);
1107
-
1108
- if (ReactNativeFeatureFlags.enableCustomFocusSearchOnClippedElementsAndroid()) {
1109
- // If we can find the next focus and it is a child of this view, return it, else it means we
1110
- // are leaving the scroll view and we should try to find a clipped element
1111
- if (nextFocus != null && this.findViewById(nextFocus.getId()) != null) {
1112
- return nextFocus;
1113
- }
1114
-
1115
- @Nullable View nextFocusableView = findNextFocusableView(this, focused, direction);
1116
-
1117
- if (nextFocusableView != null) {
1118
- return nextFocusableView;
1119
- }
1120
- }
1121
-
1122
- return nextFocus;
1123
- }
1124
-
1125
- @Override
1126
- public void updateClippingRect() {
1127
- updateClippingRect(null);
1128
- }
1129
-
1130
- @Override
1131
- public void updateClippingRect(@Nullable Set<Integer> excludedViewId) {
1132
- if (!mRemoveClippedSubviews) {
1133
- return;
1134
- }
1135
-
1136
- Systrace.beginSection(Systrace.TRACE_TAG_REACT, "ReactHorizontalScrollView.updateClippingRect");
1137
- try {
1138
- Assertions.assertNotNull(mClippingRect);
1139
-
1140
- ReactClippingViewGroupHelper.calculateClippingRect(this, mClippingRect);
1141
- View contentView = getContentView();
1142
- if (contentView instanceof ReactClippingViewGroup) {
1143
- ((ReactClippingViewGroup) contentView).updateClippingRect(excludedViewId);
1144
- }
1145
- } finally {
1146
- Systrace.endSection(Systrace.TRACE_TAG_REACT);
1147
- }
1148
- }
1149
-
1150
- @Override
1151
- public void getClippingRect(Rect outClippingRect) {
1152
- outClippingRect.set(Assertions.assertNotNull(mClippingRect));
1153
- }
1154
-
1155
- @Override
1156
- public boolean getChildVisibleRect(View child, Rect r, android.graphics.Point offset) {
1157
- return super.getChildVisibleRect(child, r, offset);
1158
- }
1159
-
1160
- private int getSnapInterval() {
1161
- if (mSnapInterval != 0) {
1162
- return mSnapInterval;
1163
- }
1164
- return getWidth();
1165
- }
1166
-
1167
- private View getContentView() {
1168
- return getChildAt(0);
1169
- }
1170
-
1171
- public void setEndFillColor(int color) {
1172
- if (color != mEndFillColor) {
1173
- mEndFillColor = color;
1174
- mEndBackground = new ColorDrawable(mEndFillColor);
1175
- }
1176
- }
1177
-
1178
- @Override
1179
- protected void onOverScrolled(int scrollX, int scrollY, boolean clampedX, boolean clampedY) {
1180
- if (DEBUG_MODE) {
1181
- FLog.i(
1182
- TAG,
1183
- "onOverScrolled[%d] scrollX %d scrollY %d clampedX %b clampedY %b",
1184
- getId(),
1185
- scrollX,
1186
- scrollY,
1187
- clampedX,
1188
- clampedY);
1189
- }
1190
-
1191
- if (mScroller != null) {
1192
- // FB SCROLLVIEW CHANGE
1193
-
1194
- // This is part two of the reimplementation of fling to fix the bounce-back bug. See #fling()
1195
- // for
1196
- // more information.
1197
-
1198
- if (!mScroller.isFinished() && mScroller.getCurrX() != mScroller.getFinalX()) {
1199
- int scrollRange = Math.max(computeHorizontalScrollRange() - getWidth(), 0);
1200
- if (scrollX >= scrollRange) {
1201
- mScroller.abortAnimation();
1202
- scrollX = scrollRange;
1203
- }
1204
- }
1205
-
1206
- // END FB SCROLLVIEW CHANGE
1207
- }
1208
-
1209
- if (ReactNativeFeatureFlags.shouldTriggerResponderTransferOnScrollAndroid()
1210
- && clampedX
1211
- && mEmittedOverScrollSinceScrollBegin == false) {
1212
- ReactScrollViewHelper.emitScrollEvent(this, 0f, 0f);
1213
- mEmittedOverScrollSinceScrollBegin = true;
1214
- }
1215
-
1216
- super.onOverScrolled(scrollX, scrollY, clampedX, clampedY);
1217
- }
1218
-
1219
- @Override
1220
- public void onChildViewAdded(View parent, View child) {
1221
- mContentView = child;
1222
- mContentView.addOnLayoutChangeListener(this);
1223
- }
1224
-
1225
- @Override
1226
- public @Nullable void onChildViewRemoved(View parent, View child) {
1227
- if (mContentView != null) {
1228
- mContentView.removeOnLayoutChangeListener(this);
1229
- }
1230
- mContentView = null;
1231
- }
1232
-
1233
- private void enableFpsListener() {
1234
- if (isScrollPerfLoggingEnabled()) {
1235
- Assertions.assertNotNull(mFpsListener);
1236
- Assertions.assertNotNull(mScrollPerfTag);
1237
- mFpsListener.enable(mScrollPerfTag);
1238
- }
1239
- }
1240
-
1241
- private void disableFpsListener() {
1242
- if (isScrollPerfLoggingEnabled()) {
1243
- Assertions.assertNotNull(mFpsListener);
1244
- Assertions.assertNotNull(mScrollPerfTag);
1245
- mFpsListener.disable(mScrollPerfTag);
1246
- }
1247
- }
1248
-
1249
- private boolean isScrollPerfLoggingEnabled() {
1250
- return mFpsListener != null && mScrollPerfTag != null && !mScrollPerfTag.isEmpty();
1251
- }
1252
-
1253
- @Override
1254
- public void draw(Canvas canvas) {
1255
- if (mEndFillColor != Color.TRANSPARENT) {
1256
- final View content = getContentView();
1257
- if (mEndBackground != null && content != null && content.getRight() < getWidth()) {
1258
- mEndBackground.setBounds(content.getRight(), 0, getWidth(), getHeight());
1259
- mEndBackground.draw(canvas);
1260
- }
1261
- }
1262
- super.draw(canvas);
1263
- }
1264
-
1265
- /**
1266
- * This handles any sort of scrolling that may occur after a touch is finished. This may be
1267
- * momentum scrolling (fling) or because you have pagingEnabled on the scroll view. Because we
1268
- * don't get any events from Android about this lifecycle, we do all our detection by creating a
1269
- * runnable that checks if we scrolled in the last frame and if so assumes we are still scrolling.
1270
- */
1271
- private void handlePostTouchScrolling(int velocityX, int velocityY) {
1272
- if (DEBUG_MODE) {
1273
- FLog.i(
1274
- TAG,
1275
- "handlePostTouchScrolling[%d] velocityX %d velocityY %d",
1276
- getId(),
1277
- velocityX,
1278
- velocityY);
1279
- }
1280
-
1281
- // Check if we are already handling this which may occur if this is called by both the touch up
1282
- // and a fling call
1283
- if (mPostTouchRunnable != null) {
1284
- return;
1285
- }
1286
-
1287
- if (mSendMomentumEvents) {
1288
- ReactScrollViewHelper.emitScrollMomentumBeginEvent(this, velocityX, velocityY);
1289
- }
1290
-
1291
- mActivelyScrolling = false;
1292
- mPostTouchRunnable =
1293
- new Runnable() {
1294
-
1295
- private boolean mSnappingToPage = false;
1296
- private int mStableFrames = 0;
1297
-
1298
- @Override
1299
- public void run() {
1300
- if (mActivelyScrolling) {
1301
- // We are still scrolling.
1302
- mActivelyScrolling = false;
1303
- mStableFrames = 0;
1304
- ReactHorizontalScrollView.this.postOnAnimationDelayed(
1305
- this, ReactScrollViewHelper.MOMENTUM_DELAY);
1306
- } else {
1307
- // There has not been a scroll update since the last time this Runnable executed.
1308
- ReactScrollViewHelper.updateFabricScrollState(ReactHorizontalScrollView.this);
1309
-
1310
- // We keep checking for updates until the ScrollView has "stabilized" and hasn't
1311
- // scrolled for N consecutive frames. This number is arbitrary: big enough to catch
1312
- // a number of race conditions, but small enough to not cause perf regressions, etc.
1313
- // In anecdotal testing, it seemed like a decent number.
1314
- // Without this check, sometimes this Runnable stops executing too soon - it will
1315
- // fire before the first scroll event of an animated scroll/fling, and stop
1316
- // immediately.
1317
- mStableFrames++;
1318
-
1319
- if (mStableFrames >= 3) {
1320
- mPostTouchRunnable = null;
1321
- if (mSendMomentumEvents) {
1322
- ReactScrollViewHelper.emitScrollMomentumEndEvent(ReactHorizontalScrollView.this);
1323
- }
1324
- ReactScrollViewHelper.notifyUserDrivenScrollEnded_internal(
1325
- ReactHorizontalScrollView.this);
1326
- disableFpsListener();
1327
- } else {
1328
- if (mPagingEnabled && !mSnappingToPage) {
1329
- // If we have pagingEnabled and we have not snapped to the page
1330
- // we need to cause that scroll by asking for it
1331
- mSnappingToPage = true;
1332
- flingAndSnap(0);
1333
- }
1334
- // The scrollview has not "stabilized" so we just post to check again a frame later
1335
- ReactHorizontalScrollView.this.postOnAnimationDelayed(
1336
- this, ReactScrollViewHelper.MOMENTUM_DELAY);
1337
- }
1338
- }
1339
- }
1340
- };
1341
- postOnAnimationDelayed(mPostTouchRunnable, ReactScrollViewHelper.MOMENTUM_DELAY);
1342
- }
1343
-
1344
- private void cancelPostTouchScrolling() {
1345
- if (mPostTouchRunnable != null) {
1346
- removeCallbacks(mPostTouchRunnable);
1347
- mPostTouchRunnable = null;
1348
- getFlingAnimator().cancel();
1349
- }
1350
- }
1351
-
1352
- private int predictFinalScrollPosition(int velocityX) {
1353
- // predict where a fling would end up so we can scroll to the nearest snap offset
1354
- final int maximumOffset = Math.max(0, computeHorizontalScrollRange() - getWidth());
1355
- // TODO(T106335409): Existing prediction still uses overscroller. Consider change this to use
1356
- // fling animator instead.
1357
- return getFlingAnimator() == DEFAULT_FLING_ANIMATOR
1358
- ? ReactScrollViewHelper.predictFinalScrollPosition(this, velocityX, 0, maximumOffset, 0).x
1359
- : ReactScrollViewHelper.getNextFlingStartValue(
1360
- this,
1361
- getScrollX(),
1362
- getReactScrollViewScrollState().getFinalAnimatedPositionScroll().x,
1363
- velocityX)
1364
- + getFlingExtrapolatedDistance(velocityX);
1365
- }
1366
-
1367
- /**
1368
- * This will smooth scroll us to the nearest snap offset point. It currently just looks at where
1369
- * the content is and slides to the nearest point. It is intended to be run after we are done
1370
- * scrolling, and handling any momentum scrolling.
1371
- */
1372
- private void smoothScrollAndSnap(int velocity) {
1373
- if (DEBUG_MODE) {
1374
- FLog.i(TAG, "smoothScrollAndSnap[%d] velocity %d", getId(), velocity);
1375
- }
1376
-
1377
- double interval = (double) getSnapInterval();
1378
- double currentOffset =
1379
- (double)
1380
- (ReactScrollViewHelper.getNextFlingStartValue(
1381
- this,
1382
- getScrollX(),
1383
- getReactScrollViewScrollState().getFinalAnimatedPositionScroll().x,
1384
- velocity));
1385
- double targetOffset = (double) predictFinalScrollPosition(velocity);
1386
-
1387
- int previousPage = (int) Math.floor(currentOffset / interval);
1388
- int nextPage = (int) Math.ceil(currentOffset / interval);
1389
- int currentPage = (int) Math.round(currentOffset / interval);
1390
- int targetPage = (int) Math.round(targetOffset / interval);
1391
-
1392
- if (velocity > 0 && nextPage == previousPage) {
1393
- nextPage++;
1394
- } else if (velocity < 0 && previousPage == nextPage) {
1395
- previousPage--;
1396
- }
1397
-
1398
- if (
1399
- // if scrolling towards next page
1400
- velocity > 0
1401
- &&
1402
- // and the middle of the page hasn't been crossed already
1403
- currentPage < nextPage
1404
- &&
1405
- // and it would have been crossed after flinging
1406
- targetPage > previousPage) {
1407
- currentPage = nextPage;
1408
- } else if (
1409
- // if scrolling towards previous page
1410
- velocity < 0
1411
- &&
1412
- // and the middle of the page hasn't been crossed already
1413
- currentPage > previousPage
1414
- &&
1415
- // and it would have been crossed after flinging
1416
- targetPage < nextPage) {
1417
- currentPage = previousPage;
1418
- }
1419
-
1420
- targetOffset = currentPage * interval;
1421
- if (targetOffset != currentOffset) {
1422
- mActivelyScrolling = true;
1423
- reactSmoothScrollTo((int) targetOffset, getScrollY());
1424
- }
1425
- }
1426
-
1427
- private void flingAndSnap(int velocityX) {
1428
- if (DEBUG_MODE) {
1429
- FLog.i(TAG, "smoothScrollAndSnap[%d] velocityX %d", getId(), velocityX);
1430
- }
1431
-
1432
- if (getChildCount() <= 0) {
1433
- return;
1434
- }
1435
-
1436
- // pagingEnabled only allows snapping one interval at a time
1437
- if (mSnapInterval == 0 && mSnapOffsets == null && (mSnapToAlignment == SNAP_ALIGNMENT_DISABLED || mSnapToAlignment == SNAP_ALIGNMENT_ITEM)) {
1438
- smoothScrollAndSnap(velocityX);
1439
- return;
1440
- }
1441
-
1442
- boolean hasCustomizedFlingAnimator = getFlingAnimator() != DEFAULT_FLING_ANIMATOR;
1443
- int maximumOffset = Math.max(0, computeHorizontalScrollRange() - getWidth());
1444
- int targetOffset = predictFinalScrollPosition(velocityX);
1445
- if (mDisableIntervalMomentum) {
1446
- targetOffset = getScrollX();
1447
- }
1448
-
1449
- int smallerOffset = 0;
1450
- int largerOffset = maximumOffset;
1451
- int firstOffset = 0;
1452
- int lastOffset = maximumOffset;
1453
- int width = getWidth() - ViewCompat.getPaddingStart(this) - ViewCompat.getPaddingEnd(this);
1454
-
1455
- // offsets are from the right edge in RTL layouts
1456
- if (getLayoutDirection() == LAYOUT_DIRECTION_RTL) {
1457
- targetOffset = maximumOffset - targetOffset;
1458
- velocityX = -velocityX;
1459
- }
1460
-
1461
- // get the nearest snap points to the target offset
1462
- if (mSnapOffsets != null && !mSnapOffsets.isEmpty()) {
1463
- firstOffset = mSnapOffsets.get(0);
1464
- lastOffset = mSnapOffsets.get(mSnapOffsets.size() - 1);
1465
-
1466
- for (int i = 0; i < mSnapOffsets.size(); i++) {
1467
- int offset = mSnapOffsets.get(i);
1468
-
1469
- if (offset <= targetOffset) {
1470
- if (targetOffset - offset < targetOffset - smallerOffset) {
1471
- smallerOffset = offset;
1472
- }
1473
- }
1474
-
1475
- if (offset >= targetOffset) {
1476
- if (offset - targetOffset < largerOffset - targetOffset) {
1477
- largerOffset = offset;
1478
- }
1479
- }
1480
- }
1481
- } else if (mSnapToAlignment != SNAP_ALIGNMENT_DISABLED && mSnapToAlignment != SNAP_ALIGNMENT_ITEM) {
1482
- if (mSnapInterval > 0) {
1483
- double ratio = (double) targetOffset / mSnapInterval;
1484
- smallerOffset =
1485
- Math.max(
1486
- getItemStartOffset(
1487
- mSnapToAlignment,
1488
- (int) (Math.floor(ratio) * mSnapInterval),
1489
- mSnapInterval,
1490
- width),
1491
- 0);
1492
- largerOffset =
1493
- Math.min(
1494
- getItemStartOffset(
1495
- mSnapToAlignment,
1496
- (int) (Math.ceil(ratio) * mSnapInterval),
1497
- mSnapInterval,
1498
- width),
1499
- maximumOffset);
1500
- } else {
1501
- ViewGroup contentView = (ViewGroup) getContentView();
1502
- int smallerChildOffset = largerOffset;
1503
- int largerChildOffset = smallerOffset;
1504
- for (int i = 0; i < contentView.getChildCount(); i++) {
1505
- View item = contentView.getChildAt(i);
1506
- int itemStartOffset =
1507
- getItemStartOffset(mSnapToAlignment, item.getLeft(), item.getWidth(), width);
1508
- if (itemStartOffset <= targetOffset) {
1509
- if (targetOffset - itemStartOffset < targetOffset - smallerOffset) {
1510
- smallerOffset = itemStartOffset;
1511
- }
1512
- }
1513
-
1514
- if (itemStartOffset >= targetOffset) {
1515
- if (itemStartOffset - targetOffset < largerOffset - targetOffset) {
1516
- largerOffset = itemStartOffset;
1517
- }
1518
- }
1519
-
1520
- smallerChildOffset = Math.min(smallerChildOffset, itemStartOffset);
1521
- largerChildOffset = Math.max(largerChildOffset, itemStartOffset);
1522
- }
1523
-
1524
- // For Recycler ViewGroup, the maximumOffset can be much larger than the total heights of
1525
- // items in the layout. In this case snapping is not possible beyond the currently rendered
1526
- // children.
1527
- smallerOffset = Math.max(smallerOffset, smallerChildOffset);
1528
- largerOffset = Math.min(largerOffset, largerChildOffset);
1529
- }
1530
- } else {
1531
- double interval = getSnapInterval();
1532
- double ratio = (double) targetOffset / interval;
1533
- smallerOffset = (int) (Math.floor(ratio) * interval);
1534
- largerOffset = Math.min((int) (Math.ceil(ratio) * interval), maximumOffset);
1535
- }
1536
-
1537
- // Calculate the nearest offset
1538
- int nearestOffset =
1539
- Math.abs(targetOffset - smallerOffset) < Math.abs(largerOffset - targetOffset)
1540
- ? smallerOffset
1541
- : largerOffset;
1542
-
1543
- // if scrolling after the last snap offset and snapping to the
1544
- // end of the list is disabled, then we allow free scrolling
1545
- int currentOffset = getScrollX();
1546
- if (getLayoutDirection() == LAYOUT_DIRECTION_RTL) {
1547
- currentOffset = maximumOffset - currentOffset;
1548
- }
1549
- if (!mSnapToEnd && targetOffset >= lastOffset) {
1550
- if (currentOffset >= lastOffset) {
1551
- // free scrolling
1552
- } else {
1553
- // snap to end
1554
- targetOffset = lastOffset;
1555
- }
1556
- } else if (!mSnapToStart && targetOffset <= firstOffset) {
1557
- if (currentOffset <= firstOffset) {
1558
- // free scrolling
1559
- } else {
1560
- // snap to beginning
1561
- targetOffset = firstOffset;
1562
- }
1563
- } else if (velocityX > 0) {
1564
- if (!hasCustomizedFlingAnimator) {
1565
- // The default animator requires boost on initial velocity as when snapping velocity can
1566
- // feel sluggish for slow swipes
1567
- velocityX += (int) ((largerOffset - targetOffset) * 10.0);
1568
- }
1569
-
1570
- targetOffset = largerOffset;
1571
- } else if (velocityX < 0) {
1572
- if (!hasCustomizedFlingAnimator) {
1573
- // The default animator requires boost on initial velocity as when snapping velocity can
1574
- // feel sluggish for slow swipes
1575
- velocityX -= (int) ((targetOffset - smallerOffset) * 10.0);
1576
- }
1577
-
1578
- targetOffset = smallerOffset;
1579
- } else {
1580
- targetOffset = nearestOffset;
1581
- }
1582
-
1583
- // Make sure the new offset isn't out of bounds
1584
- targetOffset = Math.min(Math.max(0, targetOffset), maximumOffset);
1585
-
1586
- if (getLayoutDirection() == LAYOUT_DIRECTION_RTL) {
1587
- targetOffset = maximumOffset - targetOffset;
1588
- velocityX = -velocityX;
1589
- }
1590
-
1591
- if (hasCustomizedFlingAnimator || mScroller == null) {
1592
- reactSmoothScrollTo(targetOffset, getScrollY());
1593
- } else {
1594
- // smoothScrollTo will always scroll over 250ms which is often *waaay*
1595
- // too short and will cause the scrolling to feel almost instant
1596
- // try to manually interact with OverScroller instead
1597
- // if velocity is 0 however, fling() won't work, so we want to use smoothScrollTo
1598
- mActivelyScrolling = true;
1599
-
1600
- mScroller.fling(
1601
- getScrollX(), // startX
1602
- getScrollY(), // startY
1603
- // velocity = 0 doesn't work with fling() so we pretend there's a reasonable
1604
- // initial velocity going on when a touch is released without any movement
1605
- velocityX != 0 ? velocityX : targetOffset - getScrollX(), // velocityX
1606
- 0, // velocityY
1607
- // setting both minX and maxX to the same value will guarantee that we scroll to it
1608
- // but using the standard fling-style easing rather than smoothScrollTo's 250ms animation
1609
- targetOffset, // minX
1610
- targetOffset, // maxX
1611
- 0, // minY
1612
- 0, // maxY
1613
- // we only want to allow overscrolling if the final offset is at the very edge of the view
1614
- (targetOffset == 0 || targetOffset == maximumOffset) ? width / 2 : 0, // overX
1615
- 0 // overY
1616
- );
1617
-
1618
- postInvalidateOnAnimation();
1619
- }
1620
- }
1621
-
1622
- private int getItemStartOffset(
1623
- int snapToAlignment, int itemStartPosition, int itemWidth, int viewPortWidth) {
1624
- int itemStartOffset;
1625
- switch (snapToAlignment) {
1626
- case SNAP_ALIGNMENT_CENTER:
1627
- itemStartOffset = itemStartPosition - (viewPortWidth - itemWidth) / 2;
1628
- break;
1629
- case SNAP_ALIGNMENT_START:
1630
- itemStartOffset = itemStartPosition;
1631
- break;
1632
- case SNAP_ALIGNMENT_END:
1633
- itemStartOffset = itemStartPosition - (viewPortWidth - itemWidth);
1634
- break;
1635
- default:
1636
- throw new IllegalStateException("Invalid SnapToAlignment value: " + mSnapToAlignment);
1637
- }
1638
- return itemStartOffset;
1639
- }
1640
-
1641
- private void smoothScrollToNextPage(int direction) {
1642
- if (DEBUG_MODE) {
1643
- FLog.i(TAG, "smoothScrollToNextPage[%d] direction %d", getId(), direction);
1644
- }
1645
-
1646
- int width = getWidth();
1647
- int currentX = getScrollX();
1648
-
1649
- int page = currentX / width;
1650
- if (currentX % width != 0) {
1651
- page++;
1652
- }
1653
-
1654
- if (direction == View.FOCUS_LEFT) {
1655
- page = page - 1;
1656
- } else {
1657
- page = page + 1;
1658
- }
1659
-
1660
- if (page < 0) {
1661
- page = 0;
1662
- }
1663
-
1664
- reactSmoothScrollTo(page * width, getScrollY());
1665
- handlePostTouchScrolling(0, 0);
1666
- }
1667
-
1668
- @Override
1669
- public void setBackgroundColor(int color) {
1670
- BackgroundStyleApplicator.setBackgroundColor(this, color);
1671
- }
1672
-
1673
- public void setBorderWidth(int position, float width) {
1674
- BackgroundStyleApplicator.setBorderWidth(
1675
- this, LogicalEdge.values()[position], PixelUtil.toDIPFromPixel(width));
1676
- }
1677
-
1678
- public void setBorderColor(int position, @Nullable Integer color) {
1679
- BackgroundStyleApplicator.setBorderColor(this, LogicalEdge.values()[position], color);
1680
- }
1681
-
1682
- public void setBorderRadius(float borderRadius) {
1683
- setBorderRadius(borderRadius, BorderRadiusProp.BORDER_RADIUS.ordinal());
1684
- }
1685
-
1686
- public void setBorderRadius(float borderRadius, int position) {
1687
- @Nullable
1688
- LengthPercentage radius =
1689
- Float.isNaN(borderRadius)
1690
- ? null
1691
- : new LengthPercentage(
1692
- PixelUtil.toDIPFromPixel(borderRadius), LengthPercentageType.POINT);
1693
- BackgroundStyleApplicator.setBorderRadius(this, BorderRadiusProp.values()[position], radius);
1694
- }
1695
-
1696
- public void setBorderStyle(@Nullable String style) {
1697
- BackgroundStyleApplicator.setBorderStyle(
1698
- this, style == null ? null : BorderStyle.fromString(style));
1699
- }
1700
-
1701
- /**
1702
- * Calls `smoothScrollTo` and updates state.
1703
- *
1704
- * <p>`smoothScrollTo` changes `contentOffset` and we need to keep `contentOffset` in sync between
1705
- * scroll view and state. Calling raw `smoothScrollTo` doesn't update state.
1706
- */
1707
- @Override
1708
- public void reactSmoothScrollTo(int x, int y) {
1709
- if (mScrollAnimationEnabled || !UiModeUtils.isTVDevice(getContext())) {
1710
- ReactScrollViewHelper.smoothScrollTo(this, x, y);
1711
- } else {
1712
- scrollTo(x, y);
1713
- }
1714
- setPendingContentOffsets(x, y);
1715
- }
1716
-
1717
- /**
1718
- * Calls `super.scrollTo` and updates state.
1719
- *
1720
- * <p>`super.scrollTo` changes `contentOffset` and we need to keep `contentOffset` in sync between
1721
- * scroll view and state.
1722
- *
1723
- * <p>Note that while we can override scrollTo, we *cannot* override `smoothScrollTo` because it
1724
- * is final. See `reactSmoothScrollTo`.
1725
- */
1726
- @Override
1727
- public void scrollTo(int x, int y) {
1728
- if (DEBUG_MODE) {
1729
- FLog.i(TAG, "scrollTo[%d] x %d y %d", getId(), x, y);
1730
- }
1731
-
1732
- super.scrollTo(x, y);
1733
- ReactScrollViewHelper.updateFabricScrollState(this);
1734
- setPendingContentOffsets(x, y);
1735
- }
1736
-
1737
- /** Scrolls to a new position preserving any momentum scrolling animation. */
1738
- @Override
1739
- public void scrollToPreservingMomentum(int x, int y) {
1740
- scrollTo(x, y);
1741
- recreateFlingAnimation(x, Integer.MAX_VALUE);
1742
- }
1743
-
1744
- private boolean isContentReady() {
1745
- View child = getContentView();
1746
- return child != null && child.getWidth() != 0 && child.getHeight() != 0;
1747
- }
1748
-
1749
- /**
1750
- * If contentOffset is set before the View has been laid out, store the values and set them when
1751
- * `onLayout` is called.
1752
- *
1753
- * @param x
1754
- * @param y
1755
- */
1756
- private void setPendingContentOffsets(int x, int y) {
1757
- if (DEBUG_MODE) {
1758
- FLog.i(TAG, "setPendingContentOffsets[%d] x %d y %d", getId(), x, y);
1759
- }
1760
-
1761
- if (isContentReady()) {
1762
- mPendingContentOffsetX = UNSET_CONTENT_OFFSET;
1763
- mPendingContentOffsetY = UNSET_CONTENT_OFFSET;
1764
- } else {
1765
- mPendingContentOffsetX = x;
1766
- mPendingContentOffsetY = y;
1767
- }
1768
- }
1769
-
1770
- @Override
1771
- public void onLayoutChange(
1772
- View v,
1773
- int left,
1774
- int top,
1775
- int right,
1776
- int bottom,
1777
- int oldLeft,
1778
- int oldTop,
1779
- int oldRight,
1780
- int oldBottom) {
1781
- if (mContentView == null) {
1782
- return;
1783
- }
1784
-
1785
- // Adjust the scroll position to follow new content. In RTL, this means we keep a constant
1786
- // offset from the right edge instead of the left edge, so content added to the end of the flow
1787
- // does not shift layout. If `maintainVisibleContentPosition` is enabled, we try to adjust
1788
- // position so that the viewport keeps the same insets to previously visible views. TODO: MVCP
1789
- // does not work in RTL.
1790
- if (v.getLayoutDirection() == LAYOUT_DIRECTION_RTL) {
1791
- adjustPositionForContentChangeRTL(left, right, oldLeft, oldRight);
1792
- }
1793
- ReactScrollViewHelper.emitLayoutChangeEvent(this);
1794
- }
1795
-
1796
- /**
1797
- * If we are in the middle of a fling animation from the user removing their finger (OverScroller
1798
- * is in `FLING_MODE`), recreate the existing fling animation since it was calculated against
1799
- * outdated scroll offsets.
1800
- */
1801
- private void recreateFlingAnimation(int scrollX, int maxX) {
1802
- // If we have any pending custom flings (e.g. from animated `scrollTo`, or flinging to a snap
1803
- // point), cancel them.
1804
- // TODO: Can we be more graceful (like OverScroller flings)?
1805
- if (getFlingAnimator().isRunning()) {
1806
- getFlingAnimator().cancel();
1807
- }
1808
-
1809
- if (mScroller != null && !mScroller.isFinished()) {
1810
- // Calculate the velocity and position of the fling animation at the time of this layout
1811
- // event, which may be later than the last ScrollView tick. These values are not committed to
1812
- // the underlying ScrollView, which will recalculate positions on its next tick.
1813
- int scrollerXBeforeTick = mScroller.getCurrX();
1814
- boolean hasMoreTicks = mScroller.computeScrollOffset();
1815
-
1816
- // Stop the existing animation at the current state of the scroller. We will then recreate
1817
- // it starting at the adjusted x offset.
1818
- mScroller.forceFinished(true);
1819
-
1820
- if (hasMoreTicks) {
1821
- // OverScroller.getCurrVelocity() returns an absolute value of the velocity a current fling
1822
- // animation (only FLING_MODE animations). We derive direction along the X axis from the
1823
- // start and end of the, animation assuming HorizontalScrollView never fires vertical fling
1824
- // animations.
1825
- // TODO: This does not fully handle overscroll.
1826
- float direction = Math.signum(mScroller.getFinalX() - mScroller.getStartX());
1827
- float flingVelocityX = mScroller.getCurrVelocity() * direction;
1828
-
1829
- mScroller.fling(scrollX, getScrollY(), (int) flingVelocityX, 0, 0, maxX, 0, 0);
1830
- } else {
1831
- scrollTo(scrollX + (mScroller.getCurrX() - scrollerXBeforeTick), getScrollY());
1832
- }
1833
- }
1834
- }
1835
-
1836
- private void adjustPositionForContentChangeRTL(int left, int right, int oldLeft, int oldRight) {
1837
- // If we have any pending custom flings (e.g. from animated `scrollTo`, or flinging to a snap
1838
- // point), finish them, committing the final `scrollX`.
1839
- // TODO: Can we be more graceful (like OverScroller flings)?
1840
- if (getFlingAnimator().isRunning()) {
1841
- getFlingAnimator().end();
1842
- }
1843
-
1844
- int distanceToRightEdge = oldRight - getScrollX();
1845
- int newWidth = right - left;
1846
- int scrollX = newWidth - distanceToRightEdge;
1847
- scrollTo(scrollX, getScrollY());
1848
-
1849
- recreateFlingAnimation(scrollX, newWidth - getWidth());
1850
- }
1851
-
1852
- @Nullable
1853
- @Override
1854
- public StateWrapper getStateWrapper() {
1855
- return mStateWrapper;
1856
- }
1857
-
1858
- public void setStateWrapper(StateWrapper stateWrapper) {
1859
- mStateWrapper = stateWrapper;
1860
- }
1861
-
1862
- @Override
1863
- public void setReactScrollViewScrollState(ReactScrollViewScrollState scrollState) {
1864
- mReactScrollViewScrollState = scrollState;
1865
- if (ReactNativeFeatureFlags.enableViewCulling()
1866
- || ReactNativeFeatureFlags.useTraitHiddenOnAndroid()) {
1867
- Point scrollPosition = scrollState.getLastStateUpdateScroll();
1868
- restoreScrollTo(scrollPosition.x, scrollPosition.y);
1869
- }
1870
- }
1871
-
1872
- protected void restoreScrollTo(int x, int y) {
1873
- scrollTo(x, y);
1874
- }
1875
-
1876
- @Override
1877
- public ReactScrollViewScrollState getReactScrollViewScrollState() {
1878
- return mReactScrollViewScrollState;
1879
- }
1880
-
1881
- @Override
1882
- public void startFlingAnimator(int start, int end) {
1883
- // Always cancel existing animator before starting the new one. `smoothScrollTo` contains some
1884
- // logic that, if called multiple times in a short amount of time, will treat all calls as part
1885
- // of the same animation and will not lengthen the duration of the animation. This means that,
1886
- // for example, if the user is scrolling rapidly, multiple pages could be considered part of one
1887
- // animation, causing some page animations to be animated very rapidly - looking like they're
1888
- // not animated at all.
1889
- DEFAULT_FLING_ANIMATOR.cancel();
1890
-
1891
- // Update the fling animator with new values
1892
- int duration = ReactScrollViewHelper.getDefaultScrollAnimationDuration(getContext());
1893
- DEFAULT_FLING_ANIMATOR.setDuration(duration).setIntValues(start, end);
1894
-
1895
- // Start the animator
1896
- DEFAULT_FLING_ANIMATOR.start();
1897
-
1898
- if (mSendMomentumEvents) {
1899
- int xVelocity = 0;
1900
- if (duration > 0) {
1901
- xVelocity = (end - start) / duration;
1902
- }
1903
- ReactScrollViewHelper.emitScrollMomentumBeginEvent(this, xVelocity, 0);
1904
- ReactScrollViewHelper.dispatchMomentumEndOnAnimationEnd(this);
1905
- }
1906
- }
1907
-
1908
- @Override
1909
- public ValueAnimator getFlingAnimator() {
1910
- return DEFAULT_FLING_ANIMATOR;
1911
- }
1912
-
1913
- @Override
1914
- public int getFlingExtrapolatedDistance(int velocityX) {
1915
- // The DEFAULT_FLING_ANIMATOR uses AccelerateDecelerateInterpolator, which is not depending on
1916
- // the init velocity. We use the overscroller to decide the fling distance.
1917
- return ReactScrollViewHelper.predictFinalScrollPosition(
1918
- this, velocityX, 0, Math.max(0, computeHorizontalScrollRange() - getWidth()), 0)
1919
- .x;
1920
- }
1921
-
1922
- public void setPointerEvents(PointerEvents pointerEvents) {
1923
- mPointerEvents = pointerEvents;
1924
- }
1925
-
1926
- public PointerEvents getPointerEvents() {
1927
- return mPointerEvents;
1928
- }
1929
-
1930
- @Override
1931
- public void setScrollEventThrottle(int scrollEventThrottle) {
1932
- mScrollEventThrottle = scrollEventThrottle;
1933
- }
1934
-
1935
- @Override
1936
- public int getScrollEventThrottle() {
1937
- return mScrollEventThrottle;
1938
- }
1939
-
1940
- @Override
1941
- public void setLastScrollDispatchTime(long lastScrollDispatchTime) {
1942
- mLastScrollDispatchTime = lastScrollDispatchTime;
1943
- }
1944
-
1945
- @Override
1946
- public long getLastScrollDispatchTime() {
1947
- return mLastScrollDispatchTime;
1948
- }
1949
- }