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,1744 +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.accessibility.AccessibilityNodeInfo;
33
- import android.widget.OverScroller;
34
- import android.widget.ScrollView;
35
- import androidx.annotation.NonNull;
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.bridge.ReadableMap;
45
- import com.facebook.react.common.ReactConstants;
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.List;
71
- import java.util.Set;
72
-
73
- /**
74
- * A simple subclass of ScrollView that doesn't dispatch measure and layout to its children and has
75
- * a scroll listener to send scroll events to JS.
76
- *
77
- * <p>ReactScrollView only supports vertical scrolling. For horizontal scrolling, use {@link
78
- * ReactHorizontalScrollView}.
79
- */
80
- @Nullsafe(Nullsafe.Mode.LOCAL)
81
- public class ReactScrollView extends ScrollView
82
- implements ReactClippingViewGroup,
83
- ViewGroup.OnHierarchyChangeListener,
84
- View.OnLayoutChangeListener,
85
- ReactAccessibleScrollView,
86
- ReactOverflowViewWithInset,
87
- HasScrollState,
88
- HasStateWrapper,
89
- HasFlingAnimator,
90
- HasScrollEventThrottle,
91
- HasSmoothScroll,
92
- VirtualViewContainer {
93
-
94
- private static @Nullable Field sScrollerField;
95
- private static boolean sTriedToGetScrollerField = false;
96
-
97
- private static final int UNSET_CONTENT_OFFSET = -1;
98
-
99
- private final OnScrollDispatchHelper mOnScrollDispatchHelper = new OnScrollDispatchHelper();
100
- private final @Nullable OverScroller mScroller;
101
- private final VelocityHelper mVelocityHelper = new VelocityHelper();
102
- private final Rect mTempRect = new Rect();
103
- private final ValueAnimator DEFAULT_FLING_ANIMATOR = ObjectAnimator.ofInt(this, "scrollY", 0, 0);
104
- private final @Nullable FpsListener mFpsListener;
105
-
106
- private Rect mOverflowInset;
107
- private @Nullable VirtualViewContainerState mVirtualViewContainerState;
108
- private boolean mActivelyScrolling;
109
- private @Nullable Rect mClippingRect;
110
- private Overflow mOverflow;
111
- private boolean mDragging;
112
- private boolean mPagingEnabled;
113
- private @Nullable Runnable mPostTouchRunnable;
114
- private boolean mRemoveClippedSubviews;
115
- private boolean mScrollEnabled;
116
- private boolean mSendMomentumEvents;
117
- private @Nullable String mScrollPerfTag;
118
- private @Nullable Drawable mEndBackground;
119
- private int mEndFillColor;
120
- private boolean mDisableIntervalMomentum;
121
- private int mSnapInterval;
122
- private @Nullable List<Integer> mSnapOffsets;
123
- private boolean mSnapToStart;
124
- private boolean mSnapToEnd;
125
- private int mSnapToAlignment;
126
- private @Nullable View mContentView;
127
- private @Nullable ReadableMap mCurrentContentOffset;
128
- private int mPendingContentOffsetX;
129
- private int mPendingContentOffsetY;
130
- private @Nullable StateWrapper mStateWrapper;
131
- private ReactScrollViewScrollState mReactScrollViewScrollState;
132
- private PointerEvents mPointerEvents;
133
- private long mLastScrollDispatchTime;
134
- private int mScrollEventThrottle;
135
- private @Nullable MaintainVisibleScrollPositionHelper mMaintainVisibleContentPositionHelper;
136
- private int mFadingEdgeLengthStart;
137
- private int mFadingEdgeLengthEnd;
138
- private boolean mEmittedOverScrollSinceScrollBegin;
139
- private boolean mScrollsChildToFocus = true;
140
- private int mSnapToItemPadding;
141
- private boolean mScrollAnimationEnabled = true;
142
- private boolean mBlockScrollDelta = false;
143
-
144
- public ReactScrollView(Context context) {
145
- this(context, null);
146
- }
147
-
148
- public ReactScrollView(Context context, @Nullable FpsListener fpsListener) {
149
- super(context);
150
- mFpsListener = fpsListener;
151
-
152
- mScroller = getOverScrollerFromParent();
153
- setOnHierarchyChangeListener(this);
154
- setScrollBarStyle(SCROLLBARS_OUTSIDE_OVERLAY);
155
- setClipChildren(false);
156
-
157
- ViewCompat.setAccessibilityDelegate(this, new ReactScrollViewAccessibilityDelegate());
158
- initView();
159
- }
160
-
161
- /**
162
- * Set all default values here as opposed to in the constructor or field defaults. It is important
163
- * that these properties are set during the constructor, but also on-demand whenever an existing
164
- * ReactTextView is recycled.
165
- */
166
- private void initView() {
167
- mOverflowInset = new Rect();
168
- mVirtualViewContainerState = null;
169
- mActivelyScrolling = false;
170
- mClippingRect = null;
171
-
172
- // The default value for `overflow` is set to `Visible` in the Yoga style props.
173
- mOverflow =
174
- ReactNativeFeatureFlags.enablePropsUpdateReconciliationAndroid()
175
- ? Overflow.VISIBLE
176
- : Overflow.SCROLL;
177
-
178
- mDragging = false;
179
- mPagingEnabled = false;
180
- mPostTouchRunnable = null;
181
- mRemoveClippedSubviews = false;
182
- mScrollEnabled = true;
183
- mSendMomentumEvents = false;
184
- mScrollPerfTag = null;
185
- mEndBackground = null;
186
- mEndFillColor = Color.TRANSPARENT;
187
- mDisableIntervalMomentum = false;
188
- mSnapInterval = 0;
189
- mSnapOffsets = null;
190
- mSnapToStart = true;
191
- mSnapToEnd = true;
192
- mSnapToAlignment = SNAP_ALIGNMENT_DISABLED;
193
- mContentView = null;
194
- mCurrentContentOffset = null;
195
- mPendingContentOffsetX = UNSET_CONTENT_OFFSET;
196
- mPendingContentOffsetY = UNSET_CONTENT_OFFSET;
197
- mStateWrapper = null;
198
- mReactScrollViewScrollState = new ReactScrollViewScrollState();
199
- mPointerEvents = PointerEvents.AUTO;
200
- mLastScrollDispatchTime = 0;
201
- mScrollEventThrottle = 0;
202
- mMaintainVisibleContentPositionHelper = null;
203
- mFadingEdgeLengthStart = 0;
204
- mFadingEdgeLengthEnd = 0;
205
- mEmittedOverScrollSinceScrollBegin = false;
206
- mScrollsChildToFocus = true;
207
- }
208
-
209
- /* package */ void recycleView() {
210
- // Set default field values
211
- initView();
212
-
213
- // If the view is still attached to a parent, we need to remove it from the parent
214
- // before we can recycle it.
215
- if (getParent() != null) {
216
- ((ViewGroup) getParent()).removeView(this);
217
- }
218
- updateView();
219
- }
220
-
221
- private void updateView() {}
222
-
223
- @Override
224
- public VirtualViewContainerState getVirtualViewContainerState() {
225
- if (mVirtualViewContainerState == null) {
226
- mVirtualViewContainerState = VirtualViewContainerState.create(this);
227
- }
228
-
229
- return mVirtualViewContainerState;
230
- }
231
-
232
- @Override
233
- public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
234
- super.onInitializeAccessibilityNodeInfo(info);
235
-
236
- // Expose the testID prop as the resource-id name of the view. Black-box E2E/UI testing
237
- // frameworks, which interact with the UI through the accessibility framework, do not have
238
- // access to view tags. This allows developers/testers to avoid polluting the
239
- // content-description with test identifiers.
240
- final String testId = (String) this.getTag(R.id.react_test_id);
241
- if (testId != null) {
242
- info.setViewIdResourceName(testId);
243
- }
244
- }
245
-
246
- @Nullable
247
- protected OverScroller getOverScrollerFromParent() {
248
- OverScroller scroller;
249
-
250
- if (!sTriedToGetScrollerField) {
251
- sTriedToGetScrollerField = true;
252
- try {
253
- sScrollerField = ScrollView.class.getDeclaredField("mScroller");
254
- sScrollerField.setAccessible(true);
255
- } catch (NoSuchFieldException e) {
256
- FLog.w(
257
- ReactConstants.TAG,
258
- "Failed to get mScroller field for ScrollView! "
259
- + "This app will exhibit the bounce-back scrolling bug :(");
260
- }
261
- }
262
-
263
- if (sScrollerField != null) {
264
- try {
265
- Object scrollerValue = sScrollerField.get(this);
266
- if (scrollerValue instanceof OverScroller) {
267
- scroller = (OverScroller) scrollerValue;
268
- } else {
269
- FLog.w(
270
- ReactConstants.TAG,
271
- "Failed to cast mScroller field in ScrollView (probably due to OEM changes to AOSP)! "
272
- + "This app will exhibit the bounce-back scrolling bug :(");
273
- scroller = null;
274
- }
275
- } catch (IllegalAccessException e) {
276
- throw new RuntimeException("Failed to get mScroller from ScrollView!", e);
277
- }
278
- } else {
279
- scroller = null;
280
- }
281
-
282
- return scroller;
283
- }
284
-
285
- public void setDisableIntervalMomentum(boolean disableIntervalMomentum) {
286
- mDisableIntervalMomentum = disableIntervalMomentum;
287
- }
288
-
289
- public void setSendMomentumEvents(boolean sendMomentumEvents) {
290
- mSendMomentumEvents = sendMomentumEvents;
291
- }
292
-
293
- public void setScrollPerfTag(@Nullable String scrollPerfTag) {
294
- mScrollPerfTag = scrollPerfTag;
295
- }
296
-
297
- public void setScrollEnabled(boolean scrollEnabled) {
298
- mScrollEnabled = scrollEnabled;
299
- }
300
-
301
- @Override
302
- public boolean getScrollEnabled() {
303
- return mScrollEnabled;
304
- }
305
-
306
- public void setPagingEnabled(boolean pagingEnabled) {
307
- mPagingEnabled = pagingEnabled;
308
- }
309
-
310
- public void setScrollsChildToFocus(boolean scrollsChildToFocus) {
311
- mScrollsChildToFocus = scrollsChildToFocus;
312
- }
313
-
314
- public void setDecelerationRate(float decelerationRate) {
315
- getReactScrollViewScrollState().setDecelerationRate(decelerationRate);
316
-
317
- if (mScroller != null) {
318
- mScroller.setFriction(1.0f - decelerationRate);
319
- }
320
- }
321
-
322
- public void abortAnimation() {
323
- if (mScroller != null && !mScroller.isFinished()) {
324
- mScroller.abortAnimation();
325
- }
326
- }
327
-
328
- public void setSnapInterval(int snapInterval) {
329
- mSnapInterval = snapInterval;
330
- }
331
-
332
- public void setSnapOffsets(@Nullable List<Integer> snapOffsets) {
333
- mSnapOffsets = snapOffsets;
334
- }
335
-
336
- public void setSnapToStart(boolean snapToStart) {
337
- mSnapToStart = snapToStart;
338
- }
339
-
340
- public void setSnapToEnd(boolean snapToEnd) {
341
- mSnapToEnd = snapToEnd;
342
- }
343
-
344
- public void setSnapToAlignment(int snapToAlignment) {
345
- mSnapToAlignment = snapToAlignment;
346
- }
347
-
348
- public void flashScrollIndicators() {
349
- awakenScrollBars();
350
- }
351
-
352
- public int getFadingEdgeLengthStart() {
353
- return mFadingEdgeLengthStart;
354
- }
355
-
356
- public int getFadingEdgeLengthEnd() {
357
- return mFadingEdgeLengthEnd;
358
- }
359
-
360
- public void setFadingEdgeLengthStart(int start) {
361
- mFadingEdgeLengthStart = start;
362
- invalidate();
363
- }
364
-
365
- public void setFadingEdgeLengthEnd(int end) {
366
- mFadingEdgeLengthEnd = end;
367
- invalidate();
368
- }
369
-
370
- public void setSnapToItemPadding(int snapToItemPadding) {
371
- mSnapToItemPadding = snapToItemPadding;
372
- }
373
-
374
- public void setScrollAnimationEnabled(boolean scrollAnimationEnabled) {
375
- mScrollAnimationEnabled = scrollAnimationEnabled;
376
- }
377
-
378
- @Override
379
- protected float getTopFadingEdgeStrength() {
380
- float max = Math.max(mFadingEdgeLengthStart, mFadingEdgeLengthEnd);
381
- return (mFadingEdgeLengthStart / max);
382
- }
383
-
384
- @Override
385
- protected float getBottomFadingEdgeStrength() {
386
- float max = Math.max(mFadingEdgeLengthStart, mFadingEdgeLengthEnd);
387
- return (mFadingEdgeLengthEnd / max);
388
- }
389
-
390
- public void setOverflow(@Nullable String overflow) {
391
- if (overflow == null) {
392
- mOverflow = Overflow.SCROLL;
393
- } else {
394
- @Nullable Overflow parsedOverflow = Overflow.fromString(overflow);
395
- mOverflow =
396
- parsedOverflow == null
397
- ? (ReactNativeFeatureFlags.enablePropsUpdateReconciliationAndroid()
398
- ? Overflow.VISIBLE
399
- : Overflow.SCROLL)
400
- : parsedOverflow;
401
- }
402
-
403
- invalidate();
404
- }
405
-
406
- public void setMaintainVisibleContentPosition(
407
- @Nullable MaintainVisibleScrollPositionHelper.Config config) {
408
- if (config != null && mMaintainVisibleContentPositionHelper == null) {
409
- mMaintainVisibleContentPositionHelper = new MaintainVisibleScrollPositionHelper(this, false);
410
- mMaintainVisibleContentPositionHelper.start();
411
- } else if (config == null && mMaintainVisibleContentPositionHelper != null) {
412
- mMaintainVisibleContentPositionHelper.stop();
413
- mMaintainVisibleContentPositionHelper = null;
414
- }
415
- if (mMaintainVisibleContentPositionHelper != null) {
416
- mMaintainVisibleContentPositionHelper.setConfig(config);
417
- }
418
- }
419
-
420
- @Override
421
- public @Nullable String getOverflow() {
422
- switch (mOverflow) {
423
- case HIDDEN:
424
- return "hidden";
425
- case SCROLL:
426
- return "scroll";
427
- case VISIBLE:
428
- return "visible";
429
- }
430
-
431
- return null;
432
- }
433
-
434
- @Override
435
- public void setOverflowInset(int left, int top, int right, int bottom) {
436
- mOverflowInset.set(left, top, right, bottom);
437
- }
438
-
439
- @Override
440
- public Rect getOverflowInset() {
441
- return mOverflowInset;
442
- }
443
-
444
- @Override
445
- protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
446
- MeasureSpecAssertions.assertExplicitMeasureSpec(widthMeasureSpec, heightMeasureSpec);
447
-
448
- setMeasuredDimension(
449
- MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.getSize(heightMeasureSpec));
450
- }
451
-
452
- @Override
453
- protected void onLayout(boolean changed, int l, int t, int r, int b) {
454
- // Apply pending contentOffset in case it was set before the view was laid out.
455
- if (isContentReady()) {
456
- // If a "pending" content offset value has been set, we restore that value.
457
- // Upon call to scrollTo, the "pending" values will be re-set.
458
- int scrollToX =
459
- mPendingContentOffsetX != UNSET_CONTENT_OFFSET ? mPendingContentOffsetX : getScrollX();
460
- int scrollToY =
461
- mPendingContentOffsetY != UNSET_CONTENT_OFFSET ? mPendingContentOffsetY : getScrollY();
462
- scrollTo(scrollToX, scrollToY);
463
- }
464
-
465
- ReactScrollViewHelper.emitLayoutEvent(this);
466
- if (mVirtualViewContainerState != null) {
467
- mVirtualViewContainerState.updateState();
468
- }
469
- }
470
-
471
- @Override
472
- protected void onSizeChanged(int w, int h, int oldw, int oldh) {
473
- super.onSizeChanged(w, h, oldw, oldh);
474
- if (mRemoveClippedSubviews) {
475
- updateClippingRect();
476
- }
477
- if (mVirtualViewContainerState != null) {
478
- mVirtualViewContainerState.updateState();
479
- }
480
- }
481
-
482
- @Override
483
- protected void onAttachedToWindow() {
484
- super.onAttachedToWindow();
485
- if (mRemoveClippedSubviews) {
486
- updateClippingRect();
487
- }
488
- if (mMaintainVisibleContentPositionHelper != null) {
489
- mMaintainVisibleContentPositionHelper.start();
490
- }
491
- }
492
-
493
- @Override
494
- protected void onDetachedFromWindow() {
495
- super.onDetachedFromWindow();
496
- if (mMaintainVisibleContentPositionHelper != null) {
497
- mMaintainVisibleContentPositionHelper.stop();
498
- }
499
- }
500
-
501
- @Override
502
- public @Nullable View focusSearch(View focused, @FocusDirection int direction) {
503
- View nextFocus = super.focusSearch(focused, direction);
504
-
505
- if (ReactNativeFeatureFlags.enableCustomFocusSearchOnClippedElementsAndroid()) {
506
- // If we can find the next focus and it is a child of this view, return it, else it means we
507
- // are leaving the scroll view and we should try to find a clipped element
508
- if (nextFocus != null && this.findViewById(nextFocus.getId()) != null) {
509
- return nextFocus;
510
- }
511
-
512
- @Nullable View nextfocusableView = findNextFocusableView(this, focused, direction);
513
-
514
- if (nextfocusableView != null) {
515
- return nextfocusableView;
516
- }
517
- }
518
-
519
- return nextFocus;
520
- }
521
-
522
- /**
523
- * Attempts to scroll-snap to the focused child based on snapToAlignment/scrollSnapAlign
524
- * or scrollSnapOffset. Returns true if snap scrolling was performed, false otherwise.
525
- */
526
- private boolean tryScrollSnapToChild(View focused) {
527
- if (mSnapToAlignment != SNAP_ALIGNMENT_ITEM) {
528
- return false;
529
- }
530
-
531
- kotlin.Triple<View, String, Integer> result =
532
- ReactScrollViewHelper.findScrollSnap(focused, this);
533
- if (result == null) {
534
- return false;
535
- }
536
-
537
- View snapTarget = result.getFirst();
538
- String alignment = result.getSecond();
539
- Integer snapOffset = result.getThird();
540
-
541
- Rect rect = new Rect();
542
- snapTarget.getDrawingRect(rect);
543
- offsetDescendantRectToMyCoords(snapTarget, rect);
544
-
545
- int maxScrollY = getMaxScrollY();
546
-
547
- if (snapOffset != null) {
548
- int targetOffset = ReactScrollViewHelper.computeScrollSnapTargetForOffset(
549
- rect.top, snapOffset, mSnapInterval, maxScrollY);
550
- reactSmoothScrollTo(getScrollX(), targetOffset);
551
- return true;
552
- }
553
-
554
- int viewportHeight = getHeight() - getPaddingTop() - getPaddingBottom();
555
-
556
- Integer targetOffset = ReactScrollViewHelper.computeScrollSnapOffset(
557
- rect.top, rect.bottom, viewportHeight, alignment, mSnapInterval, mSnapToItemPadding, maxScrollY);
558
- if (targetOffset == null) {
559
- return false;
560
- }
561
-
562
- reactSmoothScrollTo(getScrollX(), targetOffset);
563
- return true;
564
- }
565
-
566
- @Override
567
- public boolean arrowScroll(int direction) {
568
- if (mSnapToAlignment == SNAP_ALIGNMENT_ITEM) {
569
- // When snapToAlignment is "item", find the next focusable and request focus directly.
570
- // This avoids super.arrowScroll() which starts its own scroll animation that conflicts
571
- // with tryScrollSnapToChild's snap scrolling.
572
- // requestChildFocus → tryScrollSnapToChild handles scrolling.
573
- View currentFocused = findFocus();
574
- View nextFocused = FocusFinder.getInstance().findNextFocus(this, currentFocused, direction);
575
- if (nextFocused != null && nextFocused != currentFocused && nextFocused != this) {
576
- nextFocused.requestFocus(direction);
577
- return true;
578
- }
579
- return false;
580
- }
581
- return super.arrowScroll(direction);
582
- }
583
-
584
- /**
585
- * Since ReactScrollView handles layout changes on JS side, it does not call super.onlayout due to
586
- * which mIsLayoutDirty flag in ScrollView remains true and prevents scrolling to child when
587
- * requestChildFocus is called. Overriding this method and scrolling to child without checking any
588
- * layout dirty flag. This will fix focus navigation issue for KeyEvents which are not handled by
589
- * ScrollView, for example: KEYCODE_TAB.
590
- */
591
- @Override
592
- public void requestChildFocus(View child, View focused) {
593
- if (focused != null && mScrollsChildToFocus) {
594
- if (!tryScrollSnapToChild(focused)) {
595
- scrollToChild(focused);
596
- }
597
- }
598
- requestChildFocusWithoutScroll(child, focused);
599
- }
600
-
601
- /**
602
- * In rare cases where an app overrides the built-in ReactScrollView by overriding it, and also
603
- * needs to customize scroll into view on focus behaviors, this protected method can be used to
604
- * unblocks such customization.
605
- */
606
- protected void requestChildFocusWithoutScroll(View child, View focused) {
607
- mBlockScrollDelta = true;
608
- super.requestChildFocus(child, focused);
609
- mBlockScrollDelta = false;
610
- }
611
-
612
- @Override
613
- public boolean requestChildRectangleOnScreen(View child, Rect rectangle, boolean immediate) {
614
- if (!mScrollsChildToFocus) {
615
- return false;
616
- }
617
- return super.requestChildRectangleOnScreen(child, rectangle, immediate);
618
- }
619
-
620
- private int getScrollDelta(View descendent) {
621
- descendent.getDrawingRect(mTempRect);
622
- offsetDescendantRectToMyCoords(descendent, mTempRect);
623
- return computeScrollDeltaToGetChildRectOnScreen(mTempRect);
624
- }
625
-
626
- /** Returns whether the given descendent is partially scrolled in view */
627
- @Override
628
- public boolean isPartiallyScrolledInView(View descendent) {
629
- int scrollDelta = getScrollDelta(descendent);
630
- descendent.getDrawingRect(mTempRect);
631
- return scrollDelta != 0 && Math.abs(scrollDelta) < mTempRect.width();
632
- }
633
-
634
- private void scrollToChild(View child) {
635
- // Only scroll the nearest ReactScrollView ancestor into view, rather than the focused child.
636
- // Nested ScrollView instances will handle scrolling the child into their respective viewports.
637
- View parent = child;
638
- View scrollViewAncestor = null;
639
- while (parent != null && parent != this) {
640
- if (parent instanceof ReactScrollView) {
641
- scrollViewAncestor = parent;
642
- }
643
- parent = (View) parent.getParent();
644
- }
645
-
646
- View scrollIntoViewTarget = scrollViewAncestor != null ? scrollViewAncestor : child;
647
-
648
- Rect tempRect = new Rect();
649
- scrollIntoViewTarget.getDrawingRect(tempRect);
650
-
651
- /* Offset from child's local coordinates to ScrollView coordinates */
652
- offsetDescendantRectToMyCoords(scrollIntoViewTarget, tempRect);
653
-
654
- int scrollDelta = computeScrollDeltaToGetChildRectOnScreen(tempRect);
655
-
656
- if (scrollDelta != 0) {
657
- scrollBy(0, scrollDelta);
658
- }
659
- }
660
-
661
- @Override
662
- public void computeScroll() {
663
- if (UiModeUtils.isTVDevice(getContext())
664
- && !mScrollAnimationEnabled
665
- && mScroller != null
666
- && !mScroller.isFinished()) {
667
- // Jump instantly to the target position instead of animating.
668
- scrollTo(mScroller.getFinalX(), mScroller.getFinalY());
669
- mScroller.forceFinished(true);
670
- return;
671
- }
672
- super.computeScroll();
673
- }
674
-
675
- @Override
676
- protected int computeScrollDeltaToGetChildRectOnScreen(Rect rect) {
677
- if (!mScrollEnabled || mBlockScrollDelta) {
678
- return 0;
679
- }
680
- return super.computeScrollDeltaToGetChildRectOnScreen(rect);
681
- }
682
-
683
- @Override
684
- protected void onScrollChanged(int x, int y, int oldX, int oldY) {
685
- Systrace.beginSection(Systrace.TRACE_TAG_REACT, "ReactScrollView.onScrollChanged");
686
- try {
687
- super.onScrollChanged(x, y, oldX, oldY);
688
-
689
- mActivelyScrolling = true;
690
-
691
- if (mOnScrollDispatchHelper.onScrollChanged(x, y)) {
692
- if (mRemoveClippedSubviews) {
693
- updateClippingRect();
694
- }
695
- ReactScrollViewHelper.updateStateOnScrollChanged(
696
- this,
697
- mOnScrollDispatchHelper.getXFlingVelocity(),
698
- mOnScrollDispatchHelper.getYFlingVelocity());
699
- if (mVirtualViewContainerState != null) {
700
- mVirtualViewContainerState.updateState();
701
- }
702
- }
703
- } finally {
704
- Systrace.endSection(Systrace.TRACE_TAG_REACT);
705
- }
706
- }
707
-
708
- @Override
709
- public boolean onInterceptTouchEvent(MotionEvent ev) {
710
- if (!mScrollEnabled) {
711
- return false;
712
- }
713
-
714
- // We intercept the touch event if the children are not supposed to receive it.
715
- if (!PointerEvents.canChildrenBeTouchTarget(mPointerEvents)) {
716
- return true;
717
- }
718
-
719
- try {
720
- if (super.onInterceptTouchEvent(ev)) {
721
- handleInterceptedTouchEvent(ev);
722
- return true;
723
- }
724
- } catch (IllegalArgumentException e) {
725
- // Log and ignore the error. This seems to be a bug in the android SDK and
726
- // this is the commonly accepted workaround.
727
- // https://tinyurl.com/mw6qkod (Stack Overflow)
728
- FLog.w(ReactConstants.TAG, "Error intercepting touch event.", e);
729
- }
730
-
731
- return false;
732
- }
733
-
734
- protected void handleInterceptedTouchEvent(MotionEvent ev) {
735
- if (!ReactNativeFeatureFlags.shouldTriggerResponderTransferOnScrollAndroid()) {
736
- NativeGestureUtil.notifyNativeGestureStarted(this, ev);
737
- }
738
- ReactScrollViewHelper.emitScrollBeginDragEvent(this);
739
- mDragging = true;
740
- mEmittedOverScrollSinceScrollBegin = false;
741
- enableFpsListener();
742
- getFlingAnimator().cancel();
743
- }
744
-
745
- @Override
746
- public boolean onTouchEvent(MotionEvent ev) {
747
- if (!mScrollEnabled) {
748
- return false;
749
- }
750
-
751
- // We do not accept the touch event if this view is not supposed to receive it.
752
- if (!PointerEvents.canBeTouchTarget(mPointerEvents)) {
753
- return false;
754
- }
755
-
756
- mVelocityHelper.calculateVelocity(ev);
757
- int action = ev.getActionMasked();
758
- if (action == MotionEvent.ACTION_UP && mDragging) {
759
- ReactScrollViewHelper.updateFabricScrollState(this);
760
-
761
- float velocityX = mVelocityHelper.getXVelocity();
762
- float velocityY = mVelocityHelper.getYVelocity();
763
- ReactScrollViewHelper.emitScrollEndDragEvent(this, velocityX, velocityY);
764
- if (!ReactNativeFeatureFlags.shouldTriggerResponderTransferOnScrollAndroid()) {
765
- NativeGestureUtil.notifyNativeGestureEnded(this, ev);
766
- }
767
- mDragging = false;
768
- // After the touch finishes, we may need to do some scrolling afterwards either as a result
769
- // of a fling or because we need to page align the content
770
- handlePostTouchScrolling(Math.round(velocityX), Math.round(velocityY));
771
- }
772
-
773
- if (action == MotionEvent.ACTION_DOWN) {
774
- cancelPostTouchScrolling();
775
- }
776
-
777
- return super.onTouchEvent(ev);
778
- }
779
-
780
- @Override
781
- public boolean dispatchGenericMotionEvent(MotionEvent ev) {
782
- // Ignore generic motion events (joystick, mouse wheel, trackpad) if scrolling is disabled
783
- if (!mScrollEnabled) {
784
- return false;
785
- }
786
-
787
- // We do not dispatch the motion event if its children are not supposed to receive it
788
- if (!PointerEvents.canChildrenBeTouchTarget(mPointerEvents)) {
789
- return false;
790
- }
791
-
792
- // Handle ACTION_SCROLL events (mouse wheel, trackpad, joystick)
793
- if (ev.getActionMasked() == MotionEvent.ACTION_SCROLL) {
794
- float vScroll = ev.getAxisValue(MotionEvent.AXIS_VSCROLL);
795
- if (vScroll != 0) {
796
- // Perform the scroll
797
- enableFpsListener();
798
- boolean result = super.dispatchGenericMotionEvent(ev);
799
- // Schedule snap alignment to run after scrolling stops
800
- if (result
801
- && (mPagingEnabled
802
- || mSnapInterval != 0
803
- || mSnapOffsets != null
804
- || (mSnapToAlignment != SNAP_ALIGNMENT_DISABLED && mSnapToAlignment != SNAP_ALIGNMENT_ITEM))) {
805
- // Cancel any pending post-touch runnable and reschedule
806
- if (mPostTouchRunnable != null) {
807
- removeCallbacks(mPostTouchRunnable);
808
- mPostTouchRunnable = null;
809
- }
810
- mPostTouchRunnable =
811
- new Runnable() {
812
- @Override
813
- public void run() {
814
- mPostTouchRunnable = null;
815
- // +1/-1 velocity if scrolling down or up. This is to ensure that the
816
- // next/previous page is picked rather than sliding backwards to the current page
817
- int velocityY = (int) -Math.signum(vScroll);
818
- if (mDisableIntervalMomentum) {
819
- velocityY = 0;
820
- }
821
- flingAndSnap(velocityY);
822
- handlePostTouchScrolling(0, velocityY);
823
- }
824
- };
825
- postOnAnimationDelayed(mPostTouchRunnable, ReactScrollViewHelper.MOMENTUM_DELAY);
826
- } else {
827
- handlePostTouchScrolling(0, 0);
828
- }
829
- return result;
830
- }
831
- }
832
-
833
- return super.dispatchGenericMotionEvent(ev);
834
- }
835
-
836
- @Override
837
- public boolean executeKeyEvent(KeyEvent event) {
838
- int eventKeyCode = event.getKeyCode();
839
- if (!mScrollEnabled
840
- && (eventKeyCode == KeyEvent.KEYCODE_DPAD_UP
841
- || eventKeyCode == KeyEvent.KEYCODE_DPAD_DOWN)) {
842
- return false;
843
- }
844
- return super.executeKeyEvent(event);
845
- }
846
-
847
- @Override
848
- public void setRemoveClippedSubviews(boolean removeClippedSubviews) {
849
- if (ReactNativeFeatureFlags.disableSubviewClippingAndroid()) {
850
- return;
851
- }
852
-
853
- if (removeClippedSubviews && mClippingRect == null) {
854
- mClippingRect = new Rect();
855
- }
856
- mRemoveClippedSubviews = removeClippedSubviews;
857
- updateClippingRect();
858
- }
859
-
860
- @Override
861
- public boolean getRemoveClippedSubviews() {
862
- return mRemoveClippedSubviews;
863
- }
864
-
865
- @Override
866
- public void updateClippingRect() {
867
- updateClippingRect(null);
868
- }
869
-
870
- @Override
871
- public void updateClippingRect(@Nullable Set<Integer> excludedViewsSet) {
872
- if (!mRemoveClippedSubviews) {
873
- return;
874
- }
875
-
876
- Systrace.beginSection(Systrace.TRACE_TAG_REACT, "ReactScrollView.updateClippingRect");
877
- try {
878
- Assertions.assertNotNull(mClippingRect);
879
-
880
- ReactClippingViewGroupHelper.calculateClippingRect(this, mClippingRect);
881
- View contentView = getContentView();
882
- if (contentView instanceof ReactClippingViewGroup) {
883
- ((ReactClippingViewGroup) contentView).updateClippingRect(excludedViewsSet);
884
- }
885
- } finally {
886
- Systrace.endSection(Systrace.TRACE_TAG_REACT);
887
- }
888
- }
889
-
890
- @Override
891
- public void getClippingRect(Rect outClippingRect) {
892
- outClippingRect.set(Assertions.assertNotNull(mClippingRect));
893
- }
894
-
895
- @Override
896
- public boolean getChildVisibleRect(View child, Rect r, android.graphics.Point offset) {
897
- return super.getChildVisibleRect(child, r, offset);
898
- }
899
-
900
- @Override
901
- public void fling(int velocityY) {
902
- final int correctedVelocityY = correctFlingVelocityY(velocityY);
903
-
904
- if (mPagingEnabled) {
905
- flingAndSnap(correctedVelocityY);
906
- } else if (mScroller != null) {
907
- // We provide our own version of fling that uses a different call to the standard OverScroller
908
- // which takes into account the possibility of adding new content while the ScrollView is
909
- // animating. Because we give essentially no max Y for the fling, the fling will continue as
910
- // long
911
- // as there is content. See #onOverScrolled() to see the second part of this change which
912
- // properly
913
- // aborts the scroller animation when we get to the bottom of the ScrollView content.
914
-
915
- int scrollWindowHeight = getHeight() - getPaddingBottom() - getPaddingTop();
916
-
917
- mScroller.fling(
918
- getScrollX(), // startX
919
- getScrollY(), // startY
920
- 0, // velocityX
921
- correctedVelocityY, // velocityY
922
- 0, // minX
923
- 0, // maxX
924
- 0, // minY
925
- Integer.MAX_VALUE, // maxY
926
- 0, // overX
927
- scrollWindowHeight / 2 // overY
928
- );
929
-
930
- ViewCompat.postInvalidateOnAnimation(this);
931
- } else {
932
- super.fling(correctedVelocityY);
933
- }
934
- handlePostTouchScrolling(0, correctedVelocityY);
935
- }
936
-
937
- private int correctFlingVelocityY(int velocityY) {
938
- if (Build.VERSION.SDK_INT != Build.VERSION_CODES.P) {
939
- return velocityY;
940
- }
941
-
942
- // Workaround.
943
- // On Android P if a ScrollView is inverted, we will get a wrong sign for
944
- // velocityY (see https://issuetracker.google.com/issues/112385925).
945
- // At the same time, mOnScrollDispatchHelper tracks the correct velocity direction.
946
- //
947
- // Hence, we can use the absolute value from whatever the OS gives
948
- // us and use the sign of what mOnScrollDispatchHelper has tracked.
949
- float signum = Math.signum(mOnScrollDispatchHelper.getYFlingVelocity());
950
- if (signum == 0) {
951
- signum = Math.signum(velocityY);
952
- }
953
- return (int) (Math.abs(velocityY) * signum);
954
- }
955
-
956
- private void enableFpsListener() {
957
- if (isScrollPerfLoggingEnabled()) {
958
- Assertions.assertNotNull(mFpsListener);
959
- Assertions.assertNotNull(mScrollPerfTag);
960
- mFpsListener.enable(mScrollPerfTag);
961
- }
962
- }
963
-
964
- private void disableFpsListener() {
965
- if (isScrollPerfLoggingEnabled()) {
966
- Assertions.assertNotNull(mFpsListener);
967
- Assertions.assertNotNull(mScrollPerfTag);
968
- mFpsListener.disable(mScrollPerfTag);
969
- }
970
- }
971
-
972
- private boolean isScrollPerfLoggingEnabled() {
973
- return mFpsListener != null && mScrollPerfTag != null && !mScrollPerfTag.isEmpty();
974
- }
975
-
976
- private int getMaxScrollY() {
977
- int contentHeight = mContentView == null ? 0 : mContentView.getHeight();
978
- int viewportHeight = getHeight() - getPaddingBottom() - getPaddingTop();
979
- return Math.max(0, contentHeight - viewportHeight);
980
- }
981
-
982
- @Nullable
983
- @Override
984
- public StateWrapper getStateWrapper() {
985
- return mStateWrapper;
986
- }
987
-
988
- public void setStateWrapper(StateWrapper stateWrapper) {
989
- mStateWrapper = stateWrapper;
990
- }
991
-
992
- @Override
993
- public void draw(Canvas canvas) {
994
- if (mEndFillColor != Color.TRANSPARENT) {
995
- final View contentView = getContentView();
996
- if (mEndBackground != null && contentView != null && contentView.getBottom() < getHeight()) {
997
- mEndBackground.setBounds(0, contentView.getBottom(), getWidth(), getHeight());
998
- mEndBackground.draw(canvas);
999
- }
1000
- }
1001
-
1002
- super.draw(canvas);
1003
- }
1004
-
1005
- @Override
1006
- public void onDraw(Canvas canvas) {
1007
- if (mOverflow != Overflow.VISIBLE) {
1008
- BackgroundStyleApplicator.clipToPaddingBox(this, canvas);
1009
- }
1010
- super.onDraw(canvas);
1011
- }
1012
-
1013
- /**
1014
- * This handles any sort of scrolling that may occur after a touch is finished. This may be
1015
- * momentum scrolling (fling) or because you have pagingEnabled on the scroll view. Because we
1016
- * don't get any events from Android about this lifecycle, we do all our detection by creating a
1017
- * runnable that checks if we scrolled in the last frame and if so assumes we are still scrolling.
1018
- */
1019
- private void handlePostTouchScrolling(int velocityX, int velocityY) {
1020
- // Check if we are already handling this which may occur if this is called by both the touch up
1021
- // and a fling call
1022
- if (mPostTouchRunnable != null) {
1023
- return;
1024
- }
1025
-
1026
- if (mSendMomentumEvents) {
1027
- enableFpsListener();
1028
- ReactScrollViewHelper.emitScrollMomentumBeginEvent(this, velocityX, velocityY);
1029
- }
1030
-
1031
- mActivelyScrolling = false;
1032
- mPostTouchRunnable =
1033
- new Runnable() {
1034
-
1035
- private boolean mSnappingToPage = false;
1036
- private int mStableFrames = 0;
1037
-
1038
- @Override
1039
- public void run() {
1040
- if (mActivelyScrolling) {
1041
- // We are still scrolling.
1042
- mActivelyScrolling = false;
1043
- mStableFrames = 0;
1044
- ReactScrollView.this.postOnAnimationDelayed(
1045
- this, ReactScrollViewHelper.MOMENTUM_DELAY);
1046
- } else {
1047
- // There has not been a scroll update since the last time this Runnable executed.
1048
- ReactScrollViewHelper.updateFabricScrollState(ReactScrollView.this);
1049
-
1050
- // We keep checking for updates until the ScrollView has "stabilized" and hasn't
1051
- // scrolled for N consecutive frames. This number is arbitrary: big enough to catch
1052
- // a number of race conditions, but small enough to not cause perf regressions, etc.
1053
- // In anecdotal testing, it seemed like a decent number.
1054
- // Without this check, sometimes this Runnable stops executing too soon - it will
1055
- // fire before the first scroll event of an animated scroll/fling, and stop
1056
- // immediately.
1057
- mStableFrames++;
1058
-
1059
- if (mStableFrames >= 3) {
1060
- mPostTouchRunnable = null;
1061
- if (mSendMomentumEvents) {
1062
- ReactScrollViewHelper.emitScrollMomentumEndEvent(ReactScrollView.this);
1063
- }
1064
- ReactScrollViewHelper.notifyUserDrivenScrollEnded_internal(ReactScrollView.this);
1065
- disableFpsListener();
1066
- } else {
1067
- if (mPagingEnabled && !mSnappingToPage) {
1068
- // If we have pagingEnabled and we have not snapped to the page
1069
- // we need to cause that scroll by asking for it
1070
- mSnappingToPage = true;
1071
- flingAndSnap(0);
1072
- }
1073
- // The scrollview has not "stabilized" so we just post to check again a frame later
1074
- ReactScrollView.this.postOnAnimationDelayed(
1075
- this, ReactScrollViewHelper.MOMENTUM_DELAY);
1076
- }
1077
- }
1078
- }
1079
- };
1080
- postOnAnimationDelayed(mPostTouchRunnable, ReactScrollViewHelper.MOMENTUM_DELAY);
1081
- }
1082
-
1083
- private void cancelPostTouchScrolling() {
1084
- if (mPostTouchRunnable != null) {
1085
- removeCallbacks(mPostTouchRunnable);
1086
- mPostTouchRunnable = null;
1087
- getFlingAnimator().cancel();
1088
- }
1089
- }
1090
-
1091
- private int predictFinalScrollPosition(int velocityY) {
1092
- // predict where a fling would end up so we can scroll to the nearest snap offset
1093
- // TODO(T106335409): Existing prediction still uses overscroller. Consider change this to use
1094
- // fling animator instead.
1095
- return getFlingAnimator() == DEFAULT_FLING_ANIMATOR
1096
- ? ReactScrollViewHelper.predictFinalScrollPosition(this, 0, velocityY, 0, getMaxScrollY()).y
1097
- : ReactScrollViewHelper.getNextFlingStartValue(
1098
- this,
1099
- getScrollY(),
1100
- getReactScrollViewScrollState().getFinalAnimatedPositionScroll().y,
1101
- velocityY)
1102
- + getFlingExtrapolatedDistance(velocityY);
1103
- }
1104
-
1105
- private View getContentView() {
1106
- return getChildAt(0);
1107
- }
1108
-
1109
- /**
1110
- * This will smooth scroll us to the nearest snap offset point It currently just looks at where
1111
- * the content is and slides to the nearest point. It is intended to be run after we are done
1112
- * scrolling, and handling any momentum scrolling.
1113
- */
1114
- private void smoothScrollAndSnap(int velocity) {
1115
- double interval = (double) getSnapInterval();
1116
- double currentOffset =
1117
- (double)
1118
- (ReactScrollViewHelper.getNextFlingStartValue(
1119
- this,
1120
- getScrollY(),
1121
- getReactScrollViewScrollState().getFinalAnimatedPositionScroll().y,
1122
- velocity));
1123
- double targetOffset = (double) predictFinalScrollPosition(velocity);
1124
-
1125
- int previousPage = (int) Math.floor(currentOffset / interval);
1126
- int nextPage = (int) Math.ceil(currentOffset / interval);
1127
- int currentPage = (int) Math.round(currentOffset / interval);
1128
- int targetPage = (int) Math.round(targetOffset / interval);
1129
-
1130
- if (velocity > 0 && nextPage == previousPage) {
1131
- nextPage++;
1132
- } else if (velocity < 0 && previousPage == nextPage) {
1133
- previousPage--;
1134
- }
1135
-
1136
- if (
1137
- // if scrolling towards next page
1138
- velocity > 0
1139
- &&
1140
- // and the middle of the page hasn't been crossed already
1141
- currentPage < nextPage
1142
- &&
1143
- // and it would have been crossed after flinging
1144
- targetPage > previousPage) {
1145
- currentPage = nextPage;
1146
- } else if (
1147
- // if scrolling towards previous page
1148
- velocity < 0
1149
- &&
1150
- // and the middle of the page hasn't been crossed already
1151
- currentPage > previousPage
1152
- &&
1153
- // and it would have been crossed after flinging
1154
- targetPage < nextPage) {
1155
- currentPage = previousPage;
1156
- }
1157
-
1158
- targetOffset = currentPage * interval;
1159
- if (targetOffset != currentOffset) {
1160
- mActivelyScrolling = true;
1161
- reactSmoothScrollTo(getScrollX(), (int) targetOffset);
1162
- }
1163
- }
1164
-
1165
- private void flingAndSnap(int velocityY) {
1166
- if (getChildCount() <= 0) {
1167
- return;
1168
- }
1169
-
1170
- // pagingEnabled only allows snapping one interval at a time
1171
- if (mSnapInterval == 0 && mSnapOffsets == null && (mSnapToAlignment == SNAP_ALIGNMENT_DISABLED || mSnapToAlignment == SNAP_ALIGNMENT_ITEM)) {
1172
- smoothScrollAndSnap(velocityY);
1173
- return;
1174
- }
1175
-
1176
- boolean hasCustomizedFlingAnimator = getFlingAnimator() != DEFAULT_FLING_ANIMATOR;
1177
- int maximumOffset = getMaxScrollY();
1178
- int targetOffset = predictFinalScrollPosition(velocityY);
1179
- if (mDisableIntervalMomentum) {
1180
- targetOffset = getScrollY();
1181
- }
1182
-
1183
- int smallerOffset = 0;
1184
- int largerOffset = maximumOffset;
1185
- int firstOffset = 0;
1186
- int lastOffset = maximumOffset;
1187
- int height = getHeight() - getPaddingBottom() - getPaddingTop();
1188
-
1189
- // get the nearest snap points to the target offset
1190
- if (mSnapOffsets != null) {
1191
- firstOffset = mSnapOffsets.get(0);
1192
- lastOffset = mSnapOffsets.get(mSnapOffsets.size() - 1);
1193
-
1194
- for (int i = 0; i < mSnapOffsets.size(); i++) {
1195
- int offset = mSnapOffsets.get(i);
1196
-
1197
- if (offset <= targetOffset) {
1198
- if (targetOffset - offset < targetOffset - smallerOffset) {
1199
- smallerOffset = offset;
1200
- }
1201
- }
1202
-
1203
- if (offset >= targetOffset) {
1204
- if (offset - targetOffset < largerOffset - targetOffset) {
1205
- largerOffset = offset;
1206
- }
1207
- }
1208
- }
1209
-
1210
- } else if (mSnapToAlignment != SNAP_ALIGNMENT_DISABLED && mSnapToAlignment != SNAP_ALIGNMENT_ITEM) {
1211
- if (mSnapInterval > 0) {
1212
- double ratio = (double) targetOffset / mSnapInterval;
1213
- smallerOffset =
1214
- Math.max(
1215
- getItemStartOffset(
1216
- mSnapToAlignment,
1217
- (int) (Math.floor(ratio) * mSnapInterval),
1218
- mSnapInterval,
1219
- height),
1220
- 0);
1221
- largerOffset =
1222
- Math.min(
1223
- getItemStartOffset(
1224
- mSnapToAlignment,
1225
- (int) (Math.ceil(ratio) * mSnapInterval),
1226
- mSnapInterval,
1227
- height),
1228
- maximumOffset);
1229
- } else {
1230
- ViewGroup contentView = (ViewGroup) getContentView();
1231
- int smallerChildOffset = largerOffset;
1232
- int largerChildOffset = smallerOffset;
1233
- for (int i = 0; i < contentView.getChildCount(); i++) {
1234
- View item = contentView.getChildAt(i);
1235
- int itemStartOffset;
1236
- switch (mSnapToAlignment) {
1237
- case SNAP_ALIGNMENT_CENTER:
1238
- itemStartOffset = item.getTop() - (height - item.getHeight()) / 2;
1239
- break;
1240
- case SNAP_ALIGNMENT_START:
1241
- itemStartOffset = item.getTop();
1242
- break;
1243
- case SNAP_ALIGNMENT_END:
1244
- itemStartOffset = item.getTop() - (height - item.getHeight());
1245
- break;
1246
- default:
1247
- throw new IllegalStateException("Invalid SnapToAlignment value: " + mSnapToAlignment);
1248
- }
1249
- if (itemStartOffset <= targetOffset) {
1250
- if (targetOffset - itemStartOffset < targetOffset - smallerOffset) {
1251
- smallerOffset = itemStartOffset;
1252
- }
1253
- }
1254
-
1255
- if (itemStartOffset >= targetOffset) {
1256
- if (itemStartOffset - targetOffset < largerOffset - targetOffset) {
1257
- largerOffset = itemStartOffset;
1258
- }
1259
- }
1260
-
1261
- smallerChildOffset = Math.min(smallerChildOffset, itemStartOffset);
1262
- largerChildOffset = Math.max(largerChildOffset, itemStartOffset);
1263
- }
1264
-
1265
- // For Recycler ViewGroup, the maximumOffset can be much larger than the total heights of
1266
- // items in the layout. In this case snapping is not possible beyond the currently rendered
1267
- // children.
1268
- smallerOffset = Math.max(smallerOffset, smallerChildOffset);
1269
- largerOffset = Math.min(largerOffset, largerChildOffset);
1270
- }
1271
- } else {
1272
- double interval = (double) getSnapInterval();
1273
- double ratio = (double) targetOffset / interval;
1274
- smallerOffset = (int) (Math.floor(ratio) * interval);
1275
- largerOffset = Math.min((int) (Math.ceil(ratio) * interval), maximumOffset);
1276
- }
1277
-
1278
- // Calculate the nearest offset
1279
- int nearestOffset =
1280
- Math.abs(targetOffset - smallerOffset) < Math.abs(largerOffset - targetOffset)
1281
- ? smallerOffset
1282
- : largerOffset;
1283
-
1284
- // if scrolling after the last snap offset and snapping to the
1285
- // end of the list is disabled, then we allow free scrolling
1286
- if (!mSnapToEnd && targetOffset >= lastOffset) {
1287
- if (getScrollY() >= lastOffset) {
1288
- // free scrolling
1289
- } else {
1290
- // snap to end
1291
- targetOffset = lastOffset;
1292
- }
1293
- } else if (!mSnapToStart && targetOffset <= firstOffset) {
1294
- if (getScrollY() <= firstOffset) {
1295
- // free scrolling
1296
- } else {
1297
- // snap to beginning
1298
- targetOffset = firstOffset;
1299
- }
1300
- } else if (velocityY > 0) {
1301
- if (!hasCustomizedFlingAnimator) {
1302
- // The default animator requires boost on initial velocity as when snapping velocity can
1303
- // feel sluggish for slow swipes
1304
- velocityY += (int) ((largerOffset - targetOffset) * 10.0);
1305
- }
1306
-
1307
- targetOffset = largerOffset;
1308
- } else if (velocityY < 0) {
1309
- if (!hasCustomizedFlingAnimator) {
1310
- // The default animator requires boost on initial velocity as when snapping velocity can
1311
- // feel sluggish for slow swipes
1312
- velocityY -= (int) ((targetOffset - smallerOffset) * 10.0);
1313
- }
1314
-
1315
- targetOffset = smallerOffset;
1316
- } else {
1317
- targetOffset = nearestOffset;
1318
- }
1319
-
1320
- // Make sure the new offset isn't out of bounds
1321
- targetOffset = Math.min(Math.max(0, targetOffset), maximumOffset);
1322
-
1323
- if (hasCustomizedFlingAnimator || mScroller == null) {
1324
- reactSmoothScrollTo(getScrollX(), targetOffset);
1325
- } else {
1326
- // smoothScrollTo will always scroll over 250ms which is often *waaay*
1327
- // too short and will cause the scrolling to feel almost instant
1328
- // try to manually interact with OverScroller instead
1329
- // if velocity is 0 however, fling() won't work, so we want to use smoothScrollTo
1330
- mActivelyScrolling = true;
1331
-
1332
- mScroller.fling(
1333
- getScrollX(), // startX
1334
- getScrollY(), // startY
1335
- // velocity = 0 doesn't work with fling() so we pretend there's a reasonable
1336
- // initial velocity going on when a touch is released without any movement
1337
- 0, // velocityX
1338
- velocityY != 0 ? velocityY : targetOffset - getScrollY(), // velocityY
1339
- 0, // minX
1340
- 0, // maxX
1341
- // setting both minY and maxY to the same value will guarantee that we scroll to it
1342
- // but using the standard fling-style easing rather than smoothScrollTo's 250ms animation
1343
- targetOffset, // minY
1344
- targetOffset, // maxY
1345
- 0, // overX
1346
- // we only want to allow overscrolling if the final offset is at the very edge of the view
1347
- (targetOffset == 0 || targetOffset == maximumOffset) ? height / 2 : 0 // overY
1348
- );
1349
-
1350
- postInvalidateOnAnimation();
1351
- }
1352
- }
1353
-
1354
- private int getItemStartOffset(
1355
- int snapToAlignment, int itemStartPosition, int itemHeight, int viewPortHeight) {
1356
- int itemStartOffset;
1357
- switch (snapToAlignment) {
1358
- case SNAP_ALIGNMENT_CENTER:
1359
- itemStartOffset = itemStartPosition - (viewPortHeight - itemHeight) / 2;
1360
- break;
1361
- case SNAP_ALIGNMENT_START:
1362
- itemStartOffset = itemStartPosition;
1363
- break;
1364
- case SNAP_ALIGNMENT_END:
1365
- itemStartOffset = itemStartPosition - (viewPortHeight - itemHeight);
1366
- break;
1367
- default:
1368
- throw new IllegalStateException("Invalid SnapToAlignment value: " + mSnapToAlignment);
1369
- }
1370
- return itemStartOffset;
1371
- }
1372
-
1373
- private int getSnapInterval() {
1374
- if (mSnapInterval != 0) {
1375
- return mSnapInterval;
1376
- }
1377
- return getHeight();
1378
- }
1379
-
1380
- public void setEndFillColor(int color) {
1381
- if (color != mEndFillColor) {
1382
- mEndFillColor = color;
1383
- mEndBackground = new ColorDrawable(mEndFillColor);
1384
- }
1385
- }
1386
-
1387
- @Override
1388
- protected void onOverScrolled(int scrollX, int scrollY, boolean clampedX, boolean clampedY) {
1389
- if (mScroller != null && mContentView != null) {
1390
- // This is part two of the reimplementation of fling to fix the bounce-back bug. See #fling()
1391
- // for more information.
1392
-
1393
- if (!mScroller.isFinished() && mScroller.getCurrY() != mScroller.getFinalY()) {
1394
- int scrollRange = getMaxScrollY();
1395
- if (scrollY >= scrollRange) {
1396
- mScroller.abortAnimation();
1397
- scrollY = scrollRange;
1398
- }
1399
- }
1400
- }
1401
-
1402
- if (ReactNativeFeatureFlags.shouldTriggerResponderTransferOnScrollAndroid()
1403
- && clampedY
1404
- && mEmittedOverScrollSinceScrollBegin == false) {
1405
- ReactScrollViewHelper.emitScrollEvent(this, 0f, 0f);
1406
- mEmittedOverScrollSinceScrollBegin = true;
1407
- }
1408
-
1409
- super.onOverScrolled(scrollX, scrollY, clampedX, clampedY);
1410
- }
1411
-
1412
- @Override
1413
- public void onChildViewAdded(View parent, View child) {
1414
- mContentView = child;
1415
- mContentView.addOnLayoutChangeListener(this);
1416
- }
1417
-
1418
- @Override
1419
- public void onChildViewRemoved(View parent, View child) {
1420
- if (mContentView != null) {
1421
- mContentView.removeOnLayoutChangeListener(this);
1422
- mContentView = null;
1423
- }
1424
- }
1425
-
1426
- public void setContentOffset(@Nullable ReadableMap value) {
1427
- // When contentOffset={{x:0,y:0}} with lazy load items, setContentOffset
1428
- // is repeatedly called, causing an unexpected scroll to top behavior.
1429
- // Avoid updating contentOffset if the value has not changed.
1430
- if (mCurrentContentOffset == null || !mCurrentContentOffset.equals(value)) {
1431
- mCurrentContentOffset = value;
1432
-
1433
- if (value != null) {
1434
- double x = value.hasKey("x") ? value.getDouble("x") : 0;
1435
- double y = value.hasKey("y") ? value.getDouble("y") : 0;
1436
- scrollTo((int) PixelUtil.toPixelFromDIP(x), (int) PixelUtil.toPixelFromDIP(y));
1437
- } else {
1438
- scrollTo(0, 0);
1439
- }
1440
- }
1441
- }
1442
-
1443
- /**
1444
- * Calls `smoothScrollTo` and updates state.
1445
- *
1446
- * <p>`smoothScrollTo` changes `contentOffset` and we need to keep `contentOffset` in sync between
1447
- * scroll view and state. Calling raw `smoothScrollTo` doesn't update state.
1448
- */
1449
- @Override
1450
- public void reactSmoothScrollTo(int x, int y) {
1451
- if (mScrollAnimationEnabled || !UiModeUtils.isTVDevice(getContext())) {
1452
- ReactScrollViewHelper.smoothScrollTo(this, x, y);
1453
- } else {
1454
- scrollTo(x, y);
1455
- }
1456
- setPendingContentOffsets(x, y);
1457
- }
1458
-
1459
- /**
1460
- * Calls `super.scrollTo` and updates state.
1461
- *
1462
- * <p>`super.scrollTo` changes `contentOffset` and we need to keep `contentOffset` in sync between
1463
- * scroll view and state.
1464
- *
1465
- * <p>Note that while we can override scrollTo, we *cannot* override `smoothScrollTo` because it
1466
- * is final. See `reactSmoothScrollTo`.
1467
- */
1468
- @Override
1469
- public void scrollTo(int x, int y) {
1470
- super.scrollTo(x, y);
1471
- ReactScrollViewHelper.updateFabricScrollState(this);
1472
- setPendingContentOffsets(x, y);
1473
- }
1474
-
1475
- /**
1476
- * If we are in the middle of a fling animation from the user removing their finger (OverScroller
1477
- * is in `FLING_MODE`), recreate the existing fling animation since it was calculated against
1478
- * outdated scroll offsets.
1479
- */
1480
- private void recreateFlingAnimation(int scrollY) {
1481
- // If we have any pending custom flings (e.g. from animated `scrollTo`, or flinging to a snap
1482
- // point), cancel them.
1483
- // TODO: Can we be more graceful (like OverScroller flings)?
1484
- if (getFlingAnimator().isRunning()) {
1485
- getFlingAnimator().cancel();
1486
- }
1487
-
1488
- if (mScroller != null && !mScroller.isFinished()) {
1489
- // Calculate the velocity and position of the fling animation at the time of this layout
1490
- // event, which may be later than the last ScrollView tick. These values are not committed to
1491
- // the underlying ScrollView, which will recalculate positions on its next tick.
1492
- int scrollerYBeforeTick = mScroller.getCurrY();
1493
- boolean hasMoreTicks = mScroller.computeScrollOffset();
1494
-
1495
- // Stop the existing animation at the current state of the scroller. We will then recreate
1496
- // it starting at the adjusted y offset.
1497
- mScroller.forceFinished(true);
1498
-
1499
- if (hasMoreTicks) {
1500
- // OverScroller.getCurrVelocity() returns an absolute value of the velocity a current fling
1501
- // animation (only FLING_MODE animations). We derive direction along the Y axis from the
1502
- // start and end of the, animation assuming ScrollView never fires horizontal fling
1503
- // animations.
1504
- // TODO: This does not fully handle overscroll.
1505
- float direction = Math.signum(mScroller.getFinalY() - mScroller.getStartY());
1506
- float flingVelocityY = mScroller.getCurrVelocity() * direction;
1507
-
1508
- mScroller.fling(getScrollX(), scrollY, 0, (int) flingVelocityY, 0, 0, 0, Integer.MAX_VALUE);
1509
- } else {
1510
- scrollTo(getScrollX(), scrollY + (mScroller.getCurrY() - scrollerYBeforeTick));
1511
- }
1512
- }
1513
- }
1514
-
1515
- /** Scrolls to a new position preserving any momentum scrolling animation. */
1516
- @Override
1517
- public void scrollToPreservingMomentum(int x, int y) {
1518
- scrollTo(x, y);
1519
- recreateFlingAnimation(y);
1520
- }
1521
-
1522
- private boolean isContentReady() {
1523
- View child = getContentView();
1524
- return child != null && child.getWidth() != 0 && child.getHeight() != 0;
1525
- }
1526
-
1527
- /**
1528
- * If contentOffset is set before the View has been laid out, store the values and set them when
1529
- * `onLayout` is called.
1530
- *
1531
- * @param x
1532
- * @param y
1533
- */
1534
- private void setPendingContentOffsets(int x, int y) {
1535
- if (isContentReady()) {
1536
- mPendingContentOffsetX = UNSET_CONTENT_OFFSET;
1537
- mPendingContentOffsetY = UNSET_CONTENT_OFFSET;
1538
- } else {
1539
- mPendingContentOffsetX = x;
1540
- mPendingContentOffsetY = y;
1541
- }
1542
- }
1543
-
1544
- /**
1545
- * Called when a mContentView's layout has changed. Fixes the scroll position if it's too large
1546
- * after the content resizes. Without this, the user would see a blank ScrollView when the scroll
1547
- * position is larger than the ScrollView's max scroll position after the content shrinks.
1548
- */
1549
- @Override
1550
- public void onLayoutChange(
1551
- View v,
1552
- int left,
1553
- int top,
1554
- int right,
1555
- int bottom,
1556
- int oldLeft,
1557
- int oldTop,
1558
- int oldRight,
1559
- int oldBottom) {
1560
- if (mContentView == null) {
1561
- return;
1562
- }
1563
-
1564
- if (isShown() && isContentReady()) {
1565
- int currentScrollY = getScrollY();
1566
- int maxScrollY = getMaxScrollY();
1567
- if (currentScrollY > maxScrollY) {
1568
- scrollTo(getScrollX(), maxScrollY);
1569
- }
1570
- }
1571
-
1572
- ReactScrollViewHelper.emitLayoutChangeEvent(this);
1573
- }
1574
-
1575
- @Override
1576
- public void setBackgroundColor(int color) {
1577
- BackgroundStyleApplicator.setBackgroundColor(this, color);
1578
- }
1579
-
1580
- public void setBorderWidth(int position, float width) {
1581
- BackgroundStyleApplicator.setBorderWidth(
1582
- this, LogicalEdge.values()[position], PixelUtil.toDIPFromPixel(width));
1583
- }
1584
-
1585
- public void setBorderColor(int position, @Nullable Integer color) {
1586
- BackgroundStyleApplicator.setBorderColor(this, LogicalEdge.values()[position], color);
1587
- }
1588
-
1589
- public void setBorderRadius(float borderRadius) {
1590
- setBorderRadius(borderRadius, BorderRadiusProp.BORDER_RADIUS.ordinal());
1591
- }
1592
-
1593
- public void setBorderRadius(float borderRadius, int position) {
1594
- @Nullable
1595
- LengthPercentage radius =
1596
- Float.isNaN(borderRadius)
1597
- ? null
1598
- : new LengthPercentage(
1599
- PixelUtil.toDIPFromPixel(borderRadius), LengthPercentageType.POINT);
1600
- BackgroundStyleApplicator.setBorderRadius(this, BorderRadiusProp.values()[position], radius);
1601
- }
1602
-
1603
- public void setBorderStyle(@Nullable String style) {
1604
- BackgroundStyleApplicator.setBorderStyle(
1605
- this, style == null ? null : BorderStyle.fromString(style));
1606
- }
1607
-
1608
- /**
1609
- * ScrollAway: This enables a natively-controlled navbar that optionally obscures the top content
1610
- * of the ScrollView. Whether or not the navbar is obscuring the React Native surface is
1611
- * determined outside of React Native.
1612
- *
1613
- * <p>Note: all ScrollViews and HorizontalScrollViews in React have exactly one child: the
1614
- * "content" View (see ScrollView.js). That View is non-collapsable so it will never be
1615
- * View-flattened away. However, it is possible to pass custom styles into that View.
1616
- *
1617
- * <p>If you are using this feature it is assumed that you have full control over this ScrollView
1618
- * and that you are **not** overriding the ScrollView content view to pass in a `translateY`
1619
- * style. `translateY` must never be set from ReactJS while using this feature!
1620
- */
1621
- public void setScrollAwayPaddingEnabledUnstable(int topPadding, int bottomPadding) {
1622
- setScrollAwayPaddingEnabledUnstable(topPadding, bottomPadding, true);
1623
- }
1624
-
1625
- public void setScrollAwayPaddingEnabledUnstable(
1626
- int topPadding, int bottomPadding, boolean updateState) {
1627
- int count = getChildCount();
1628
-
1629
- Assertions.assertCondition(
1630
- count <= 1,
1631
- "React Native ScrollView should not have more than one child, it should have exactly 1"
1632
- + " child; a content View");
1633
-
1634
- if (count > 0) {
1635
- for (int i = 0; i < count; i++) {
1636
- View childView = getChildAt(i);
1637
- childView.setTranslationY(topPadding);
1638
- }
1639
-
1640
- // Add the topPadding value as the bottom padding for the ScrollView.
1641
- // Otherwise, we'll push down the contents of the scroll view down too
1642
- // far off screen.
1643
- setPadding(0, 0, 0, topPadding + bottomPadding);
1644
- }
1645
-
1646
- if (updateState) {
1647
- updateScrollAwayState(topPadding, bottomPadding);
1648
- }
1649
- setRemoveClippedSubviews(mRemoveClippedSubviews);
1650
- }
1651
-
1652
- private void updateScrollAwayState(int scrollAwayPaddingTop, int scrollAwayPaddingBottom) {
1653
- getReactScrollViewScrollState().setScrollAwayPaddingTop(scrollAwayPaddingTop);
1654
- getReactScrollViewScrollState().setScrollAwayPaddingBottom(scrollAwayPaddingBottom);
1655
- ReactScrollViewHelper.forceUpdateState(this);
1656
- }
1657
-
1658
- @Override
1659
- public void setReactScrollViewScrollState(ReactScrollViewScrollState scrollState) {
1660
- mReactScrollViewScrollState = scrollState;
1661
- if (ReactNativeFeatureFlags.enableViewCulling()
1662
- || ReactNativeFeatureFlags.useTraitHiddenOnAndroid()) {
1663
- setScrollAwayPaddingEnabledUnstable(
1664
- scrollState.getScrollAwayPaddingTop(), scrollState.getScrollAwayPaddingBottom(), false);
1665
-
1666
- Point scrollPosition = scrollState.getLastStateUpdateScroll();
1667
- scrollTo(scrollPosition.x, scrollPosition.y);
1668
- }
1669
- }
1670
-
1671
- @Override
1672
- public ReactScrollViewScrollState getReactScrollViewScrollState() {
1673
- return mReactScrollViewScrollState;
1674
- }
1675
-
1676
- @Override
1677
- public void startFlingAnimator(int start, int end) {
1678
- // Always cancel existing animator before starting the new one. `smoothScrollTo` contains some
1679
- // logic that, if called multiple times in a short amount of time, will treat all calls as part
1680
- // of the same animation and will not lengthen the duration of the animation. This means that,
1681
- // for example, if the user is scrolling rapidly, multiple pages could be considered part of one
1682
- // animation, causing some page animations to be animated very rapidly - looking like they're
1683
- // not animated at all.
1684
- DEFAULT_FLING_ANIMATOR.cancel();
1685
-
1686
- // Update the fling animator with new values
1687
- int duration = ReactScrollViewHelper.getDefaultScrollAnimationDuration(getContext());
1688
- DEFAULT_FLING_ANIMATOR.setDuration(duration).setIntValues(start, end);
1689
-
1690
- // Start the animator
1691
- DEFAULT_FLING_ANIMATOR.start();
1692
-
1693
- if (mSendMomentumEvents) {
1694
- int yVelocity = 0;
1695
- if (duration > 0) {
1696
- yVelocity = (end - start) / duration;
1697
- }
1698
- ReactScrollViewHelper.emitScrollMomentumBeginEvent(this, 0, yVelocity);
1699
- ReactScrollViewHelper.dispatchMomentumEndOnAnimationEnd(this);
1700
- }
1701
- }
1702
-
1703
- @NonNull
1704
- @Override
1705
- public ValueAnimator getFlingAnimator() {
1706
- return DEFAULT_FLING_ANIMATOR;
1707
- }
1708
-
1709
- @Override
1710
- public int getFlingExtrapolatedDistance(int velocityY) {
1711
- // The DEFAULT_FLING_ANIMATOR uses AccelerateDecelerateInterpolator, which is not depending on
1712
- // the init velocity. We use the overscroller to decide the fling distance.
1713
- return ReactScrollViewHelper.predictFinalScrollPosition(this, 0, velocityY, 0, getMaxScrollY())
1714
- .y;
1715
- }
1716
-
1717
- public void setPointerEvents(PointerEvents pointerEvents) {
1718
- mPointerEvents = pointerEvents;
1719
- }
1720
-
1721
- public PointerEvents getPointerEvents() {
1722
- return mPointerEvents;
1723
- }
1724
-
1725
- @Override
1726
- public void setScrollEventThrottle(int scrollEventThrottle) {
1727
- mScrollEventThrottle = scrollEventThrottle;
1728
- }
1729
-
1730
- @Override
1731
- public int getScrollEventThrottle() {
1732
- return mScrollEventThrottle;
1733
- }
1734
-
1735
- @Override
1736
- public void setLastScrollDispatchTime(long lastScrollDispatchTime) {
1737
- mLastScrollDispatchTime = lastScrollDispatchTime;
1738
- }
1739
-
1740
- @Override
1741
- public long getLastScrollDispatchTime() {
1742
- return mLastScrollDispatchTime;
1743
- }
1744
- }