react-native-tvos 0.84.0-0rc5 → 0.85.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.
- package/Libraries/ActionSheetIOS/ActionSheetIOS.js +3 -3
- package/Libraries/Animated/Animated.d.ts +8 -1
- package/Libraries/Animated/AnimatedEvent.js +4 -4
- package/Libraries/Animated/AnimatedImplementation.js +2 -2
- package/Libraries/Animated/animations/Animation.js +3 -3
- package/Libraries/Animated/animations/DecayAnimation.js +4 -4
- package/Libraries/Animated/animations/SpringAnimation.js +5 -5
- package/Libraries/Animated/animations/TimingAnimation.js +5 -5
- package/Libraries/Animated/createAnimatedComponent.js +7 -7
- package/Libraries/Animated/nodes/AnimatedColor.js +2 -2
- package/Libraries/Animated/nodes/AnimatedInterpolation.js +12 -12
- package/Libraries/Animated/nodes/AnimatedNode.js +3 -3
- package/Libraries/Animated/nodes/AnimatedObject.js +3 -3
- package/Libraries/Animated/nodes/AnimatedProps.js +6 -6
- package/Libraries/Animated/nodes/AnimatedStyle.js +7 -7
- package/Libraries/Animated/nodes/AnimatedTransform.js +13 -13
- package/Libraries/Animated/nodes/AnimatedValue.js +1 -1
- package/Libraries/Animated/nodes/AnimatedValueXY.js +1 -1
- package/Libraries/Animated/nodes/AnimatedWithChildren.js +1 -1
- package/{jest/mocks/Vibration.js → Libraries/Animated/useAnimatedColor.d.ts} +5 -6
- package/Libraries/Animated/useAnimatedColor.js +25 -0
- package/{jest/mocks/Clipboard.js → Libraries/Animated/useAnimatedValueXY.d.ts} +5 -6
- package/Libraries/Animated/useAnimatedValueXY.js +26 -0
- package/Libraries/AppDelegate/RCTAppDelegate.mm +0 -8
- package/Libraries/AppDelegate/RCTDefaultReactNativeFactoryDelegate.mm +1 -3
- package/Libraries/AppDelegate/RCTReactNativeFactory.mm +1 -0
- package/Libraries/AppDelegate/RCTRootViewFactory.mm +2 -6
- package/Libraries/AppState/AppState.js +1 -1
- package/Libraries/BatchedBridge/MessageQueue.js +3 -3
- package/Libraries/BatchedBridge/NativeModules.js +12 -10
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +30 -26
- package/Libraries/Components/ActivityIndicator/ActivityIndicator.js +2 -2
- package/Libraries/Components/Button.js +2 -2
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidTypes.js +2 -2
- package/Libraries/Components/Keyboard/Keyboard.js +6 -6
- package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +1 -1
- package/Libraries/Components/LayoutConformance/LayoutConformance.js +1 -1
- package/Libraries/Components/LayoutConformance/LayoutConformanceNativeComponent.js +1 -1
- package/Libraries/Components/Pressable/Pressable.d.ts +5 -0
- package/Libraries/Components/Pressable/Pressable.js +3 -3
- package/Libraries/Components/Pressable/useAndroidRippleForView.js +4 -4
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.js +1 -1
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroidTypes.js +3 -3
- package/Libraries/Components/RefreshControl/RefreshControl.js +5 -5
- package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +10 -12
- package/Libraries/Components/ScrollView/ScrollView.d.ts +18 -1
- package/Libraries/Components/ScrollView/ScrollView.js +33 -10
- package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +12 -18
- package/Libraries/Components/ScrollView/ScrollViewNativeComponentType.js +7 -4
- package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +1 -1
- package/Libraries/Components/StaticRenderer.js +1 -1
- package/Libraries/Components/StatusBar/StatusBar.js +8 -8
- package/Libraries/Components/Switch/Switch.js +3 -3
- package/Libraries/Components/TV/TVViewPropTypes.js +7 -0
- package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +33 -48
- package/Libraries/Components/TextInput/InputAccessoryView.js +1 -1
- package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +6 -11
- package/Libraries/Components/TextInput/TextInput.flow.js +21 -20
- package/Libraries/Components/TextInput/TextInput.js +8 -4
- package/Libraries/Components/Touchable/PooledClass.js +1 -1
- package/Libraries/Components/Touchable/Touchable.js +2 -2
- package/Libraries/Components/Touchable/TouchableBounce.js +4 -4
- package/Libraries/Components/Touchable/TouchableHighlight.js +6 -6
- package/Libraries/Components/Touchable/TouchableNativeFeedback.js +7 -7
- package/Libraries/Components/Touchable/TouchableOpacity.js +3 -3
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +1 -1
- package/Libraries/Components/UnimplementedViews/UnimplementedView.js +1 -1
- package/Libraries/Components/View/ReactNativeStyleAttributes.js +68 -31
- package/Libraries/Components/View/View.js +6 -0
- package/Libraries/Components/View/ViewAccessibility.js +7 -7
- package/Libraries/Components/View/ViewPropTypes.js +15 -15
- package/Libraries/Core/Devtools/parseHermesStack.js +8 -8
- package/Libraries/Core/Devtools/symbolicateStackTrace.js +2 -2
- package/Libraries/Core/ExceptionsManager.js +2 -2
- package/Libraries/Core/ExtendedError.js +3 -3
- package/Libraries/Core/RawEventEmitter.js +1 -1
- package/Libraries/Core/ReactNativeVersion.js +2 -2
- package/Libraries/Core/Timers/JSTimers.js +3 -2
- package/Libraries/Core/setUpDeveloperTools.js +1 -1
- package/Libraries/Core/setUpErrorHandling.js +4 -2
- package/Libraries/Core/setUpReactDevTools.js +23 -6
- package/Libraries/Core/setUpSegmentFetcher.js +1 -1
- package/Libraries/Debugging/DebuggingOverlay.js +2 -2
- package/Libraries/EventEmitter/NativeEventEmitter.js +7 -9
- package/Libraries/EventEmitter/RCTDeviceEventEmitter.js +1 -1
- package/Libraries/FBLazyVector/FBLazyVector/FBLazyIterator.h +0 -6
- package/Libraries/Image/AssetSourceResolver.js +1 -1
- package/Libraries/Image/Image.android.js +172 -306
- package/Libraries/Image/ImageProps.js +9 -11
- package/Libraries/Image/ImageSource.js +2 -2
- package/Libraries/Image/ImageSourceUtils.js +8 -4
- package/Libraries/Image/ImageTypes.flow.js +2 -2
- package/Libraries/Image/ImageViewNativeComponent.js +7 -16
- package/Libraries/Image/RCTImageUtils.mm +37 -1
- package/Libraries/Image/nativeImageSource.js +1 -1
- package/Libraries/Interaction/InteractionManager.js +5 -4
- package/Libraries/Interaction/PanResponder.js +1 -1
- package/Libraries/LayoutAnimation/LayoutAnimation.js +2 -2
- package/Libraries/Linking/Linking.js +1 -1
- package/Libraries/Lists/FlatList.js +3 -3
- package/Libraries/Lists/SectionList.js +1 -1
- package/Libraries/Lists/SectionListModern.js +2 -2
- package/Libraries/LogBox/Data/LogBoxData.js +38 -24
- package/Libraries/LogBox/Data/LogBoxLog.js +43 -112
- package/Libraries/LogBox/Data/parseLogBoxLog.js +21 -117
- package/Libraries/LogBox/LogBox.js +42 -19
- package/Libraries/LogBox/LogBoxInspectorContainer.js +2 -2
- package/Libraries/LogBox/LogBoxNotificationContainer.js +2 -2
- package/Libraries/LogBox/UI/LogBoxButton.js +28 -30
- package/Libraries/LogBox/UI/LogBoxInspector.js +2 -2
- package/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js +6 -9
- package/Libraries/LogBox/UI/LogBoxInspectorFooter.js +1 -1
- package/Libraries/LogBox/UI/LogBoxInspectorFooterButton.js +1 -1
- package/Libraries/LogBox/UI/LogBoxInspectorHeader.js +1 -1
- package/Libraries/LogBox/UI/LogBoxInspectorHeaderButton.js +1 -1
- package/Libraries/LogBox/UI/LogBoxInspectorMessageHeader.js +10 -15
- package/Libraries/LogBox/UI/LogBoxInspectorReactFrames.js +25 -18
- package/Libraries/LogBox/UI/LogBoxInspectorSection.js +5 -7
- package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js +8 -10
- package/Libraries/LogBox/UI/LogBoxInspectorStackFrame.js +8 -6
- package/Libraries/LogBox/UI/LogBoxInspectorStackFrames.js +17 -29
- package/Libraries/LogBox/UI/LogBoxMessage.js +28 -37
- package/Libraries/LogBox/UI/LogBoxNotification.js +1 -1
- package/Libraries/Modal/Modal.js +3 -3
- package/Libraries/NativeComponent/BaseViewConfig.android.js +28 -52
- package/Libraries/NativeComponent/BaseViewConfig.ios.js +19 -21
- package/Libraries/NativeComponent/TVViewConfig.js +1 -0
- package/Libraries/Network/RCTHTTPRequestHandler.h +9 -0
- package/Libraries/Network/RCTHTTPRequestHandler.mm +15 -1
- package/Libraries/Network/RCTNetworking.android.js +1 -1
- package/Libraries/Network/RCTNetworking.ios.js +1 -1
- package/Libraries/Network/RCTNetworking.js.flow +1 -1
- package/Libraries/Network/RCTNetworkingEventDefinitions.flow.js +1 -1
- package/Libraries/Network/XMLHttpRequest.js +1 -1
- package/Libraries/PermissionsAndroid/PermissionsAndroid.js +3 -3
- package/Libraries/Pressability/Pressability.js +12 -5
- package/Libraries/Pressability/PressabilityDebug.js +1 -1
- package/Libraries/Pressability/PressabilityPerformanceEventEmitter.js +1 -1
- package/Libraries/Pressability/usePressability.js +3 -14
- package/Libraries/PushNotificationIOS/PushNotificationIOS.js +2 -2
- package/Libraries/PushNotificationIOS/RCTPushNotificationManager.mm +11 -21
- package/Libraries/ReactNative/AppContainer-dev.js +18 -1
- package/Libraries/ReactNative/AppContainer.js +1 -1
- package/Libraries/ReactNative/AppRegistry.flow.js +2 -2
- package/Libraries/ReactNative/AppRegistryImpl.js +2 -2
- package/Libraries/ReactNative/FabricUIManager.js +1 -1
- package/Libraries/ReactNative/RendererImplementation.js +4 -4
- package/Libraries/ReactNative/UIManagerProperties.js +1 -1
- package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +3 -2
- package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +3 -2
- package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +3 -2
- package/Libraries/Renderer/shims/ReactFabric.js +1 -3
- package/Libraries/Renderer/shims/ReactFeatureFlags.js +1 -3
- package/Libraries/Renderer/shims/ReactNative.js +3 -2
- package/Libraries/Renderer/shims/ReactNativeTypes.js +1 -3
- package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +1 -3
- package/Libraries/Renderer/shims/createReactNativeComponentClass.js +1 -3
- package/Libraries/StyleSheet/PointPropType.js +1 -1
- package/Libraries/StyleSheet/Rect.js +1 -1
- package/Libraries/StyleSheet/StyleSheet.d.ts +0 -5
- package/Libraries/StyleSheet/StyleSheet.js +1 -1
- package/Libraries/StyleSheet/StyleSheet.js.flow +1 -1
- package/Libraries/StyleSheet/StyleSheetExports.js +16 -25
- package/Libraries/StyleSheet/StyleSheetExports.js.flow +2 -7
- package/Libraries/StyleSheet/StyleSheetTypes.js +33 -36
- package/Libraries/StyleSheet/private/_StyleSheetTypesOverrides.js +5 -5
- package/Libraries/StyleSheet/private/_TransformStyle.js +7 -7
- package/Libraries/StyleSheet/processBackgroundImage.js +7 -7
- package/Libraries/StyleSheet/processBackgroundPosition.js +4 -4
- package/Libraries/StyleSheet/processBackgroundRepeat.js +4 -4
- package/Libraries/StyleSheet/processBackgroundSize.js +4 -4
- package/Libraries/StyleSheet/processBoxShadow.js +44 -4
- package/Libraries/StyleSheet/processColorArray.js +2 -2
- package/Libraries/StyleSheet/processFilter.js +2 -2
- package/Libraries/Text/Text/RCTDynamicTypeRamp.mm +5 -4
- package/Libraries/Text/Text.js +295 -627
- package/Libraries/Text/TextInput/Multiline/RCTUITextView.mm +7 -1
- package/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.mm +14 -12
- package/Libraries/Text/TextInput/Singleline/RCTUITextField.mm +1 -1
- package/Libraries/Text/TextNativeComponent.js +14 -7
- package/Libraries/Text/TextProps.js +4 -4
- package/Libraries/Types/CodegenTypes.js +1 -1
- package/Libraries/Types/CoreEventTypes.js +21 -21
- package/Libraries/Types/ReactDevToolsTypes.js +2 -2
- package/Libraries/Utilities/Appearance.js +6 -1
- package/Libraries/Utilities/Dimensions.js +1 -1
- package/Libraries/Utilities/HMRClient.js +4 -4
- package/Libraries/Utilities/IPerformanceLogger.js +4 -4
- package/Libraries/Utilities/codegenNativeCommands.js +4 -4
- package/Libraries/Utilities/codegenNativeComponent.d.ts +2 -0
- package/Libraries/Utilities/codegenNativeComponent.js +2 -2
- package/Libraries/Utilities/logError.js +1 -1
- package/Libraries/Utilities/stringifySafe.js +3 -3
- package/Libraries/Utilities/useMergeRefs.js +2 -2
- package/Libraries/WebSocket/RCTReconnectingWebSocket.m +4 -1
- package/Libraries/vendor/core/ErrorUtils.js +4 -4
- package/Libraries/vendor/emitter/EventEmitter.js +16 -20
- package/README.md +68 -54
- package/React/Base/RCTBridge.mm +1 -1
- package/React/Base/RCTBundleURLProvider.mm +29 -8
- package/React/Base/RCTConvert.mm +3 -18
- package/React/Base/RCTDefines.h +7 -8
- package/React/Base/RCTDevSupportHttpHeaders.h +24 -0
- package/React/Base/RCTDevSupportHttpHeaders.m +65 -0
- package/React/Base/RCTJavaScriptLoader.h +1 -0
- package/React/Base/RCTJavaScriptLoader.mm +6 -2
- package/React/Base/RCTMultipartDataTask.h +9 -0
- package/React/Base/RCTMultipartDataTask.m +19 -1
- package/React/Base/RCTTVColorSupport.h +17 -0
- package/React/Base/RCTTVColorSupport.mm +23 -0
- package/React/Base/RCTUtils.mm +15 -6
- package/React/Base/RCTVersion.m +2 -2
- package/React/CoreModules/RCTActionSheetManager.mm +28 -3
- package/React/CoreModules/RCTClipboard.mm +5 -5
- package/React/CoreModules/RCTDevLoadingView.mm +1 -1
- package/React/CoreModules/RCTDevSettings.mm +8 -0
- package/React/CoreModules/RCTDeviceInfo.mm +4 -3
- package/React/CoreModules/RCTKeyboardObserver.mm +9 -2
- package/React/CoreModules/RCTLogBoxView.mm +4 -8
- package/React/CoreModules/RCTPerfMonitor.mm +5 -0
- package/React/CoreModules/RCTStatusBarManager.h +2 -0
- package/React/CoreModules/RCTWebSocketModule.h +6 -0
- package/React/CoreModules/RCTWebSocketModule.mm +14 -1
- package/React/DevSupport/RCTInspectorDevServerHelper.mm +33 -22
- package/React/DevSupport/RCTInspectorNetworkHelper.mm +2 -0
- package/React/FBReactNativeSpec/FBReactNativeSpecJSI.h +66 -79
- package/React/FBReactNativeSpec/react/renderer/components/FBReactNativeSpec/Props.cpp +8 -8
- package/React/FBReactNativeSpec/react/renderer/components/FBReactNativeSpec/Props.h +1 -1
- package/React/Fabric/Mounting/ComponentViews/Image/RCTImageComponentView.mm +2 -2
- package/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryComponentView.mm +4 -0
- package/React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.mm +6 -0
- package/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.mm +8 -4
- package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.h +2 -0
- package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.mm +81 -0
- package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTPullToRefreshViewComponentView.mm +16 -4
- package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +157 -8
- package/React/Fabric/Mounting/ComponentViews/Switch/RCTSwitchComponentView.mm +10 -5
- package/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm +13 -0
- package/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm +9 -13
- package/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.h +2 -0
- package/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.mm +2 -0
- package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.h +2 -0
- package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +56 -8
- package/React/Fabric/Mounting/ComponentViews/VirtualView/RCTVirtualViewComponentView.h +2 -1
- package/React/Fabric/Mounting/ComponentViews/VirtualView/RCTVirtualViewComponentView.mm +92 -163
- package/React/Fabric/Mounting/RCTMountingManager.mm +8 -3
- package/React/Fabric/RCTScheduler.h +2 -0
- package/React/Fabric/RCTScheduler.mm +57 -0
- package/React/Fabric/RCTSurfacePointerHandler.mm +15 -9
- package/React/Fabric/RCTSurfacePresenter.mm +9 -0
- package/React/Fabric/RCTSurfaceTouchHandler.mm +4 -2
- package/React/Fabric/Surface/RCTFabricSurface.mm +4 -0
- package/React/Fabric/Utils/RCTLinearGradient.mm +4 -9
- package/React/Inspector/RCTCxxInspectorWebSocketAdapter.mm +5 -1
- package/React/Modules/RCTLayoutAnimation.m +10 -0
- package/React/Modules/RCTUIManager.mm +2 -4
- package/React/Profiler/RCTProfile.m +2 -0
- package/React/React-RCTFabric.podspec +3 -0
- package/React/Views/RCTView.m +6 -1
- package/React/Views/ScrollView/RCTScrollViewManager.m +1 -0
- package/React-Core-prebuilt.podspec +1 -1
- package/ReactAndroid/api/ReactAndroid.api +120 -298
- package/ReactAndroid/build.gradle.kts +9 -0
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java +11 -101
- package/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManagerBuilder.kt +2 -2
- package/ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java +10 -10
- package/ReactAndroid/src/main/java/com/facebook/react/animated/AnimationDriver.kt +1 -3
- package/ReactAndroid/src/main/java/com/facebook/react/animated/ColorAnimatedNode.kt +11 -11
- package/ReactAndroid/src/main/java/com/facebook/react/animated/DiffClampAnimatedNode.kt +11 -11
- package/ReactAndroid/src/main/java/com/facebook/react/animated/EventAnimationDriver.kt +0 -26
- package/ReactAndroid/src/main/java/com/facebook/react/animated/InterpolationAnimatedNode.kt +12 -0
- package/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.kt +11 -1
- package/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedNodesManager.kt +5 -5
- package/ReactAndroid/src/main/java/com/facebook/react/animated/PropsAnimatedNode.kt +5 -5
- package/ReactAndroid/src/main/java/com/facebook/react/animated/SpringAnimation.kt +19 -19
- package/ReactAndroid/src/main/java/com/facebook/react/animated/TrackingAnimatedNode.kt +5 -1
- package/ReactAndroid/src/main/java/com/facebook/react/bridge/DynamicFromArray.kt +9 -4
- package/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaMethodWrapper.kt +15 -15
- package/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaOnlyMap.kt +8 -6
- package/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeModuleRegistry.kt +3 -1
- package/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java +10 -0
- package/ReactAndroid/src/main/java/com/facebook/react/bridge/ScrollEndedListener.kt +70 -0
- package/ReactAndroid/src/main/java/com/facebook/react/common/assets/ReactFontManager.kt +4 -0
- package/ReactAndroid/src/main/java/com/facebook/react/common/mapbuffer/ReadableMapBuffer.kt +4 -4
- package/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactHost.kt +36 -34
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/BundleDownloader.kt +14 -9
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/CxxInspectorPackagerConnection.kt +2 -8
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/DefaultDevLoadingViewImplementation.kt +3 -2
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevServerHelper.kt +17 -13
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerBase.kt +5 -5
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/PackagerStatusCheck.kt +10 -19
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/RedBoxContentView.kt +2 -2
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/inspector/DevSupportHttpClient.kt +74 -0
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/inspector/FrameTimingSequence.kt +2 -3
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/inspector/FrameTimingsObserver.kt +110 -80
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/inspector/InspectorNetworkHelper.kt +1 -12
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/DevBundleDownloadListener.kt +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/DevLoadingViewManager.kt +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/AnimationBackendChoreographer.kt +87 -0
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java +36 -7
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManagerBinding.kt +16 -2
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManagerProviderImpl.kt +3 -0
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/LongStreamingStats.kt +2 -2
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/SurfaceHandlerBinding.kt +6 -6
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/events/EventBeatManager.kt +2 -2
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/events/FabricEventEmitter.kt +0 -29
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountingManager.kt +2 -8
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/SurfaceMountingManager.kt +1258 -0
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/FabricNameComponentMapping.kt +1 -0
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/IntBufferBatchMountItem.kt +2 -2
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/MountItemFactory.kt +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/PreAllocateViewMountItem.kt +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt +37 -55
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt +66 -96
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt +14 -20
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt +15 -21
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt +74 -107
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsOverrides_RNOSS_Experimental_Android.kt +5 -1
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt +14 -20
- package/ReactAndroid/src/main/java/com/facebook/react/internal/interop/InteropEventEmitter.kt +1 -15
- package/ReactAndroid/src/main/java/com/facebook/react/internal/turbomodule/core/TurboModuleManager.kt +2 -2
- package/ReactAndroid/src/main/java/com/facebook/react/modules/accessibilityinfo/AccessibilityInfoModule.kt +4 -10
- package/ReactAndroid/src/main/java/com/facebook/react/modules/blob/BlobModule.kt +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/modules/core/JavaTimerManager.kt +4 -2
- package/ReactAndroid/src/main/java/com/facebook/react/modules/i18nmanager/I18nManagerModule.kt +4 -1
- package/ReactAndroid/src/main/java/com/facebook/react/modules/network/NetworkEventUtil.kt +45 -74
- package/ReactAndroid/src/main/java/com/facebook/react/modules/network/NetworkingModule.kt +17 -13
- package/ReactAndroid/src/main/java/com/facebook/react/modules/network/ProgressRequestBody.kt +2 -5
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/AndroidInfoHelpers.kt +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.kt +2 -2
- package/ReactAndroid/src/main/java/com/facebook/react/modules/websocket/WebSocketModule.kt +3 -4
- package/ReactAndroid/src/main/java/com/facebook/react/packagerconnection/JSPackagerClient.kt +2 -1
- package/ReactAndroid/src/main/java/com/facebook/react/packagerconnection/ReconnectingWebSocket.kt +2 -8
- package/ReactAndroid/src/main/java/com/facebook/react/runtime/BridgelessAtomicRef.kt +2 -0
- package/ReactAndroid/src/main/java/com/facebook/react/runtime/BridgelessCatalystInstance.kt +9 -3
- package/ReactAndroid/src/main/java/com/facebook/react/runtime/BridgelessReactContext.kt +8 -8
- package/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostImpl.kt +12 -12
- package/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostInspectorTarget.kt +2 -2
- package/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactInstance.kt +13 -7
- package/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactSurfaceView.kt +14 -14
- package/ReactAndroid/src/main/java/com/facebook/react/shell/MainReactPackage.kt +14 -6
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/BackgroundStyleApplicator.kt +42 -28
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManager.java +8 -49
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/DisplayMetricsHolder.kt +11 -8
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/GuardedFrameCallback.kt +17 -0
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/JSPointerDispatcher.java +13 -8
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/LayoutShadowNode.kt +751 -0
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyManager.java +104 -781
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyOptimizer.kt +18 -0
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactShadowNode.java +7 -9
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactShadowNodeImpl.java +7 -31
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactZIndexedViewGroup.kt +11 -1
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ThemedReactContext.kt +4 -0
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/TouchTargetHelper.kt +1 -4
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIImplementation.java +103 -759
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerHelper.kt +14 -38
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.java +41 -170
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIViewOperationQueue.java +33 -962
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewGroupDrawingOrderHelper.kt +2 -0
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/common/UIManagerType.kt +22 -0
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/common/ViewUtil.kt +15 -0
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/FabricEventDispatcher.kt +1 -6
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/RCTEventEmitter.kt +2 -9
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/RCTModernEventEmitter.kt +12 -1
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/TouchEvent.kt +1 -16
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/TouchesHelper.kt +0 -33
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BackgroundImageLayer.kt +27 -0
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BackgroundPosition.kt +20 -0
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BackgroundRepeat.kt +27 -0
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BackgroundSize.kt +50 -0
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BorderColors.kt +33 -0
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BorderInsets.kt +25 -1
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BorderRadiusStyle.kt +46 -2
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BorderStyle.kt +14 -0
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BoxShadow.kt +23 -1
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/ColorStop.kt +45 -7
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/ComputedBorderRadius.kt +40 -2
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/CornerRadii.kt +21 -1
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/Gradient.kt +16 -0
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/LinearGradient.kt +34 -0
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/LogicalEdge.kt +33 -1
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/OutlineStyle.kt +17 -0
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/Overflow.kt +15 -0
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/RadialGradient.kt +42 -0
- package/ReactAndroid/src/main/java/com/facebook/react/views/common/UiModeUtils.kt +20 -0
- package/ReactAndroid/src/main/java/com/facebook/react/views/drawer/ReactDrawerLayoutManager.kt +1 -2
- package/ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageView.kt +9 -10
- package/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostManager.kt +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ReactProgressBarViewManager.kt +6 -5
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java +132 -16
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollViewManager.kt +17 -0
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactNestedScrollView.java +1647 -0
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactNestedScrollViewManager.kt +466 -0
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java +104 -10
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewHelper.kt +71 -9
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewManager.kt +17 -0
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/VirtualViewContainer.kt +2 -35
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/VirtualViewContainerStateClassic.kt +7 -30
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/VirtualViewContainerStateExperimental.kt +20 -41
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/generate-nested-scroll-view.js +270 -0
- package/ReactAndroid/src/main/java/com/facebook/react/views/swiperefresh/ReactSwipeRefreshLayout.kt +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/views/swiperefresh/SwipeRefreshLayoutManager.kt +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/views/switchview/ReactSwitchManager.kt +7 -7
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/PreparedLayout.kt +2 -0
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/PreparedLayoutTextView.kt +39 -17
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/PreparedLayoutTextViewManager.kt +4 -3
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextUpdate.kt +4 -65
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextView.java +86 -111
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextViewAccessibilityDelegate.kt +6 -0
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextViewManager.kt +243 -20
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTypefaceUtils.kt +1 -2
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/SelectableTextViewManager.kt +29 -0
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.kt +1 -2
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManager.kt +54 -77
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/DrawCommandSpan.kt +27 -0
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/ReactClickableSpan.kt +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/ReactLinkSpan.kt +10 -3
- package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.kt +2 -75
- package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextChangedEvent.kt +8 -0
- package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextContentSizeWatcher.kt +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.kt +5 -38
- package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputTextWatcher.kt +3 -2
- package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextScrollWatcher.kt +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextSelectionWatcher.kt +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/views/view/ImportantForInteractionHelper.kt +55 -0
- package/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.kt +19 -60
- package/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewManager.kt +7 -4
- package/ReactAndroid/src/main/java/com/facebook/react/views/virtual/view/ReactVirtualView.kt +150 -296
- package/ReactAndroid/src/main/java/com/facebook/react/views/virtual/view/ReactVirtualViewManager.kt +11 -13
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaConfig.kt +2 -2
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaConfigJNIBase.kt +64 -0
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaConfigJNIFinalizer.java +4 -4
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaDirection.kt +29 -0
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaNative.kt +1 -1
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaNode.kt +244 -0
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaNodeJNIBase.java +1 -1
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaProps.kt +183 -0
- package/ReactAndroid/src/main/jni/CMakeLists.txt +6 -0
- package/ReactAndroid/src/main/jni/react/fabric/AndroidAnimationChoreographer.h +38 -0
- package/ReactAndroid/src/main/jni/react/fabric/CoreComponentsRegistry.cpp +4 -4
- package/ReactAndroid/src/main/jni/react/fabric/FabricMountingManager.cpp +7 -0
- package/ReactAndroid/src/main/jni/react/fabric/FabricMountingManager.h +2 -0
- package/ReactAndroid/src/main/jni/react/fabric/FabricUIManagerBinding.cpp +50 -2
- package/ReactAndroid/src/main/jni/react/fabric/FabricUIManagerBinding.h +11 -0
- package/ReactAndroid/src/main/jni/react/fabric/JAnimationBackendChoreographer.cpp +23 -0
- package/ReactAndroid/src/main/jni/react/fabric/JAnimationBackendChoreographer.h +37 -0
- package/ReactAndroid/src/main/jni/react/fabric/StateWrapperImpl.h +2 -1
- package/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp +89 -131
- package/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h +19 -28
- package/ReactAndroid/src/main/jni/react/jni/CMakeLists.txt +0 -1
- package/ReactAndroid/src/main/jni/react/jni/JavaModuleWrapper.cpp +1 -1
- package/ReactAndroid/src/main/jni/react/jni/OnLoad.cpp +0 -7
- package/ReactAndroid/src/main/jni/react/runtime/jni/JReactHostInspectorTarget.cpp +24 -60
- package/ReactAndroid/src/main/jni/react/runtime/jni/JReactHostInspectorTarget.h +12 -28
- package/ReactAndroid/src/main/jni/react/turbomodule/ReactCommon/TurboModuleManager.cpp +13 -6
- package/ReactAndroid/src/main/jni/react/turbomodule/ReactCommon/TurboModuleManager.h +2 -1
- package/{ReactCommon/react/renderer/components/text/ParagraphComponentDescriptor.cpp → ReactAndroid/src/main/jni/react/uimanager/StateWrapper.h} +7 -2
- package/ReactAndroid/src/main/res/views/uimanager/values/ids.xml +3 -0
- package/ReactAndroid/src/main/res/views/uimanager/values-ne/strings.xml +2 -0
- package/ReactApple/RCTAnimatedModuleProvider/RCTAnimatedModuleProvider.mm +8 -1
- package/ReactApple/RCTSwiftUI/RCTSwiftUI.podspec +1 -1
- package/ReactApple/RCTSwiftUIWrapper/RCTSwiftUIWrapper.podspec +1 -2
- package/ReactCommon/React-Fabric.podspec +5 -6
- package/ReactCommon/React-FabricComponents.podspec +6 -8
- package/ReactCommon/cxxreact/ReactNativeVersion.h +7 -5
- package/ReactCommon/hermes/executor/HermesExecutorFactory.cpp +1 -1
- package/ReactCommon/hermes/inspector-modern/chrome/HermesRuntimeTargetDelegate.cpp +25 -16
- package/ReactCommon/hermes/inspector-modern/chrome/HermesRuntimeTargetDelegate.h +1 -1
- package/ReactCommon/hermes/inspector-modern/chrome/Registration.cpp +44 -3
- package/ReactCommon/jsinspector-modern/HostAgent.cpp +10 -30
- package/ReactCommon/jsinspector-modern/HostAgent.h +4 -11
- package/ReactCommon/jsinspector-modern/HostTarget.cpp +33 -33
- package/ReactCommon/jsinspector-modern/HostTarget.h +23 -24
- package/ReactCommon/jsinspector-modern/HostTargetTraceRecording.cpp +1 -2
- package/ReactCommon/jsinspector-modern/HostTargetTracing.h +89 -0
- package/ReactCommon/jsinspector-modern/InspectorInterfaces.cpp +4 -9
- package/ReactCommon/jsinspector-modern/InspectorInterfaces.h +0 -1
- package/ReactCommon/jsinspector-modern/InspectorPackagerConnection.cpp +164 -54
- package/ReactCommon/jsinspector-modern/InspectorPackagerConnectionImpl.h +39 -4
- package/ReactCommon/jsinspector-modern/NetworkIOAgent.cpp +12 -3
- package/ReactCommon/jsinspector-modern/NetworkIOAgent.h +13 -0
- package/ReactCommon/jsinspector-modern/RuntimeAgent.cpp +6 -0
- package/ReactCommon/jsinspector-modern/RuntimeTarget.cpp +34 -18
- package/ReactCommon/jsinspector-modern/RuntimeTarget.h +19 -0
- package/ReactCommon/jsinspector-modern/RuntimeTargetDebuggerSessionObserver.cpp +6 -95
- package/ReactCommon/jsinspector-modern/RuntimeTargetGlobalStateObserver.cpp +122 -0
- package/ReactCommon/jsinspector-modern/RuntimeTargetGlobalStateObserver.h +42 -0
- package/ReactCommon/jsinspector-modern/RuntimeTargetTracingStateObserver.cpp +27 -0
- package/ReactCommon/jsinspector-modern/RuntimeTargetTracingStateObserver.h +27 -0
- package/ReactCommon/jsinspector-modern/TracingAgent.cpp +7 -45
- package/ReactCommon/jsinspector-modern/TracingAgent.h +0 -11
- package/ReactCommon/jsinspector-modern/UniqueMonostate.h +0 -4
- package/ReactCommon/jsinspector-modern/WeakList.h +60 -1
- package/ReactCommon/jsinspector-modern/network/NetworkHandler.cpp +25 -21
- package/ReactCommon/jsinspector-modern/network/NetworkHandler.h +21 -15
- package/ReactCommon/jsinspector-modern/tests/GmockHelpers.h +1 -1
- package/ReactCommon/jsinspector-modern/tests/HostTargetTest.cpp +3 -3
- package/ReactCommon/jsinspector-modern/tests/InspectorPackagerConnectionMultiSessionTest.cpp +692 -0
- package/ReactCommon/jsinspector-modern/tests/InspectorPackagerConnectionTest.cpp +10 -123
- package/ReactCommon/jsinspector-modern/tests/InspectorPackagerConnectionTest.h +140 -0
- package/ReactCommon/jsinspector-modern/tests/JsiIntegrationTest.cpp +158 -6
- package/ReactCommon/jsinspector-modern/tests/NetworkReporterTest.cpp +34 -0
- package/ReactCommon/jsinspector-modern/tests/TracingTest.cpp +223 -4
- package/ReactCommon/jsinspector-modern/tests/WeakListTest.cpp +31 -1
- package/ReactCommon/jsinspector-modern/tests/engines/JsiIntegrationTestHermesEngineAdapter.cpp +1 -1
- package/ReactCommon/jsinspector-modern/tracing/FrameTimingSequence.h +6 -9
- package/ReactCommon/jsinspector-modern/tracing/HostTracingProfileSerializer.cpp +4 -6
- package/ReactCommon/jsinspector-modern/tracing/TraceEventGenerator.cpp +6 -17
- package/ReactCommon/jsinspector-modern/tracing/TraceEventGenerator.h +4 -5
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp +27 -39
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h +32 -47
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp +153 -207
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h +18 -24
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h +26 -38
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h +56 -83
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsOverridesOSSExperimental.h +9 -1
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h +9 -12
- package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.mm +3 -1
- package/ReactCommon/react/nativemodule/defaults/CMakeLists.txt +1 -0
- package/ReactCommon/react/nativemodule/defaults/DefaultTurboModules.cpp +10 -4
- package/ReactCommon/react/nativemodule/defaults/React-defaultsnativemodule.podspec +1 -0
- package/ReactCommon/react/nativemodule/fantomtestspecificmethods/NativeFantomTestSpecificMethods.cpp +32 -0
- package/ReactCommon/react/nativemodule/fantomtestspecificmethods/NativeFantomTestSpecificMethods.h +2 -0
- package/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp +32 -47
- package/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h +14 -20
- package/ReactCommon/react/renderer/animated/AnimatedModule.h +1 -1
- package/ReactCommon/react/renderer/animated/CMakeLists.txt +0 -1
- package/ReactCommon/react/renderer/animated/NativeAnimatedNodesManager.cpp +108 -151
- package/ReactCommon/react/renderer/animated/NativeAnimatedNodesManager.h +16 -11
- package/ReactCommon/react/renderer/animated/NativeAnimatedNodesManagerProvider.cpp +80 -86
- package/ReactCommon/react/renderer/animated/NativeAnimatedNodesManagerProvider.h +0 -1
- package/ReactCommon/react/renderer/animated/event_drivers/EventAnimationDriver.h +0 -1
- package/ReactCommon/react/renderer/animated/internal/AnimatedMountingOverrideDelegate.h +0 -2
- package/ReactCommon/react/renderer/animated/internal/NativeAnimatedAllowlist.h +2 -2
- package/ReactCommon/react/renderer/animated/nodes/PropsAnimatedNode.cpp +32 -4
- package/ReactCommon/react/renderer/animated/nodes/PropsAnimatedNode.h +6 -0
- package/ReactCommon/react/renderer/animationbackend/AnimatedPropSerializer.cpp +14 -21
- package/ReactCommon/react/renderer/animationbackend/AnimatedPropsRegistry.cpp +3 -1
- package/ReactCommon/react/renderer/animationbackend/AnimatedPropsRegistry.h +6 -3
- package/ReactCommon/react/renderer/animationbackend/AnimationBackend.cpp +125 -63
- package/ReactCommon/react/renderer/animationbackend/AnimationBackend.h +33 -33
- package/ReactCommon/react/renderer/animationbackend/AnimationBackendCommitHook.cpp +18 -8
- package/ReactCommon/react/renderer/animationbackend/AnimationBackendCommitHook.h +1 -1
- package/ReactCommon/react/renderer/animationbackend/AnimationChoreographer.h +39 -0
- package/ReactCommon/react/renderer/animationbackend/CMakeLists.txt +0 -1
- package/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.cpp +1 -2
- package/ReactCommon/react/renderer/attributedstring/AttributedString.h +0 -1
- package/ReactCommon/react/renderer/attributedstring/AttributedStringBox.cpp +0 -6
- package/ReactCommon/react/renderer/attributedstring/AttributedStringBox.h +0 -1
- package/ReactCommon/react/renderer/attributedstring/ParagraphAttributes.cpp +0 -4
- package/ReactCommon/react/renderer/attributedstring/ParagraphAttributes.h +0 -1
- package/ReactCommon/react/renderer/attributedstring/conversions.h +60 -0
- package/ReactCommon/react/renderer/componentregistry/componentNameByReactViewName.cpp +3 -5
- package/ReactCommon/react/renderer/components/image/ImageProps.h +1 -1
- package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/{LegacyViewManagerInteropComponentDescriptor.mm → platform/ios/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropComponentDescriptor.mm} +1 -1
- package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/{LegacyViewManagerInteropState.mm → platform/ios/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropState.mm} +1 -1
- package/ReactCommon/react/renderer/components/root/RootShadowNode.cpp +1 -1
- package/ReactCommon/react/renderer/components/scrollview/BaseScrollViewProps.cpp +20 -0
- package/ReactCommon/react/renderer/components/scrollview/BaseScrollViewProps.h +2 -0
- package/ReactCommon/react/renderer/components/scrollview/ScrollViewState.h +1 -1
- package/ReactCommon/react/renderer/components/scrollview/conversions.h +6 -0
- package/ReactCommon/react/renderer/components/scrollview/platform/android/react/renderer/components/scrollview/HostPlatformScrollViewProps.cpp +18 -1
- package/ReactCommon/react/renderer/components/scrollview/platform/android/react/renderer/components/scrollview/HostPlatformScrollViewProps.h +2 -0
- package/ReactCommon/react/renderer/components/scrollview/primitives.h +2 -11
- package/ReactCommon/react/renderer/components/scrollview/tests/ScrollViewTest.cpp +83 -3
- package/ReactCommon/react/renderer/components/text/BaseParagraphComponentDescriptor.h +49 -0
- package/ReactCommon/react/renderer/components/text/BaseTextProps.cpp +14 -14
- package/ReactCommon/react/renderer/components/text/ParagraphComponentDescriptor.h +3 -28
- package/ReactCommon/react/renderer/components/text/ParagraphShadowNode.cpp +10 -10
- package/ReactCommon/react/renderer/components/text/ParagraphShadowNode.h +4 -4
- package/ReactCommon/react/renderer/components/text/SelectableParagraphComponentDescriptor.h +24 -0
- package/ReactCommon/react/renderer/components/text/SelectableParagraphShadowNode.h +32 -0
- package/ReactCommon/react/renderer/components/text/platform/android/react/renderer/components/text/HostPlatformParagraphProps.cpp +1 -1
- package/ReactCommon/react/renderer/components/text/platform/android/react/renderer/components/text/ParagraphState.cpp +1 -1
- package/ReactCommon/react/renderer/components/text/platform/android/react/renderer/components/text/ParagraphState.h +2 -2
- package/ReactCommon/react/renderer/components/textinput/BaseTextInputShadowNode.h +13 -1
- package/ReactCommon/react/renderer/components/textinput/TextInputEventEmitter.cpp +2 -1
- package/ReactCommon/react/renderer/components/view/AccessibilityPrimitives.h +2 -21
- package/ReactCommon/react/renderer/components/view/BackgroundImagePropsConversions.cpp +15 -24
- package/ReactCommon/react/renderer/components/view/BaseTouch.h +7 -7
- package/ReactCommon/react/renderer/components/view/BaseViewProps.cpp +11 -1
- package/ReactCommon/react/renderer/components/view/BaseViewProps.h +4 -0
- package/ReactCommon/react/renderer/components/view/ConcreteViewShadowNode.h +0 -3
- package/ReactCommon/react/renderer/components/view/FilterPropsConversions.h +57 -53
- package/ReactCommon/react/renderer/components/view/ViewShadowNode.cpp +1 -0
- package/ReactCommon/react/renderer/components/view/conversions.h +250 -2
- package/ReactCommon/react/renderer/components/view/platform/android/react/renderer/components/view/HostPlatformViewProps.cpp +19 -63
- package/ReactCommon/react/renderer/components/view/platform/android/react/renderer/components/view/HostPlatformViewProps.h +1 -0
- package/ReactCommon/react/renderer/components/view/primitives.h +3 -86
- package/ReactCommon/react/renderer/components/view/tests/ConversionsTest.cpp +215 -0
- package/ReactCommon/react/renderer/components/view/tests/LayoutTest.cpp +1 -1
- package/ReactCommon/react/renderer/components/virtualview/VirtualViewComponentDescriptor.h +1 -1
- package/ReactCommon/react/renderer/core/ConcreteComponentDescriptor.h +1 -1
- package/ReactCommon/react/renderer/core/EventEmitter.cpp +2 -2
- package/ReactCommon/react/renderer/core/EventEmitter.h +8 -8
- package/ReactCommon/react/renderer/core/EventPipe.h +1 -1
- package/ReactCommon/react/renderer/core/EventTarget.cpp +3 -3
- package/ReactCommon/react/renderer/core/EventTarget.h +7 -7
- package/ReactCommon/react/renderer/core/LayoutConstraints.h +0 -5
- package/ReactCommon/react/renderer/core/LayoutContext.h +0 -5
- package/ReactCommon/react/renderer/core/LayoutMetrics.h +0 -2
- package/ReactCommon/react/renderer/core/RawPropsKey.cpp +11 -21
- package/ReactCommon/react/renderer/core/RawPropsKey.h +0 -1
- package/ReactCommon/react/renderer/core/RawPropsKeyMap.cpp +4 -1
- package/ReactCommon/react/renderer/core/RawPropsParser.cpp +1 -7
- package/ReactCommon/react/renderer/core/RawPropsParser.h +2 -6
- package/ReactCommon/react/renderer/core/RawValue.h +1 -2
- package/ReactCommon/react/renderer/core/ShadowNode.cpp +33 -31
- package/ReactCommon/react/renderer/core/ShadowNode.h +19 -29
- package/ReactCommon/react/renderer/core/ShadowNodeFamily.cpp +6 -6
- package/ReactCommon/react/renderer/core/ShadowNodeFamily.h +14 -14
- package/ReactCommon/react/renderer/core/ShadowNodeFragment.cpp +4 -2
- package/ReactCommon/react/renderer/core/ShadowNodeFragment.h +2 -2
- package/ReactCommon/react/renderer/core/tests/ShadowNodeTest.cpp +57 -2
- package/ReactCommon/react/renderer/css/CSSBackgroundImage.h +112 -140
- package/ReactCommon/react/renderer/css/CSSColor.h +7 -8
- package/ReactCommon/react/renderer/css/CSSColorFunction.h +38 -39
- package/ReactCommon/react/renderer/css/CSSCompoundDataType.h +23 -17
- package/ReactCommon/react/renderer/css/CSSDataType.h +15 -10
- package/ReactCommon/react/renderer/css/CSSFilter.h +12 -17
- package/ReactCommon/react/renderer/css/CSSKeyword.h +8 -0
- package/ReactCommon/react/renderer/css/CSSList.h +11 -11
- package/ReactCommon/react/renderer/css/CSSRatio.h +4 -4
- package/ReactCommon/react/renderer/css/CSSShadow.h +7 -7
- package/ReactCommon/react/renderer/css/CSSSyntaxParser.h +10 -6
- package/ReactCommon/react/renderer/css/CSSTokenizer.h +2 -0
- package/ReactCommon/react/renderer/css/CSSTransform.h +20 -20
- package/ReactCommon/react/renderer/css/CSSTransformOrigin.h +4 -5
- package/ReactCommon/react/renderer/css/CSSValueParser.h +71 -67
- package/ReactCommon/react/renderer/css/tests/CSSValueParserTest.cpp +11 -10
- package/ReactCommon/react/renderer/graphics/BackgroundPosition.h +0 -1
- package/ReactCommon/react/renderer/graphics/BackgroundRepeat.h +0 -1
- package/ReactCommon/react/renderer/graphics/BackgroundSize.h +0 -1
- package/ReactCommon/react/renderer/graphics/Filter.h +3 -2
- package/ReactCommon/react/renderer/graphics/LinearGradient.cpp +9 -15
- package/ReactCommon/react/renderer/graphics/LinearGradient.h +7 -19
- package/ReactCommon/react/renderer/graphics/Point.h +0 -2
- package/ReactCommon/react/renderer/graphics/RadialGradient.h +4 -35
- package/ReactCommon/react/renderer/graphics/React-graphics.podspec +1 -0
- package/ReactCommon/react/renderer/graphics/Rect.h +1 -9
- package/ReactCommon/react/renderer/graphics/RectangleCorners.h +1 -10
- package/ReactCommon/react/renderer/graphics/RectangleEdges.h +1 -10
- package/ReactCommon/react/renderer/graphics/Size.h +0 -5
- package/ReactCommon/react/renderer/graphics/Transform.cpp +0 -4
- package/ReactCommon/react/renderer/graphics/Transform.h +1 -13
- package/ReactCommon/react/renderer/graphics/TransformUtils.h +95 -0
- package/ReactCommon/react/renderer/graphics/ValueUnit.h +3 -11
- package/ReactCommon/react/renderer/graphics/fromRawValueShared.h +13 -1
- package/ReactCommon/react/renderer/imagemanager/ImageManager.h +0 -4
- package/ReactCommon/react/renderer/imagemanager/ImageResponseObserverCoordinator.cpp +11 -12
- package/ReactCommon/react/renderer/imagemanager/ImageResponseObserverCoordinator.h +4 -3
- package/ReactCommon/react/renderer/imagemanager/platform/android/react/renderer/imagemanager/ImageRequestParams.h +1 -36
- package/ReactCommon/react/renderer/imagemanager/platform/cxx/react/renderer/imagemanager/ImageRequestParams.h +1 -9
- package/ReactCommon/react/renderer/imagemanager/platform/ios/react/renderer/imagemanager/ImageRequestParams.h +1 -9
- package/ReactCommon/react/renderer/imagemanager/platform/ios/react/renderer/imagemanager/RCTSyncImageManager.mm +1 -1
- package/ReactCommon/react/renderer/imagemanager/primitives.h +0 -5
- package/ReactCommon/react/renderer/mapbuffer/MapBuffer.cpp +51 -30
- package/ReactCommon/react/renderer/mapbuffer/MapBuffer.h +2 -0
- package/ReactCommon/react/renderer/mounting/Differentiator.cpp +21 -38
- package/ReactCommon/react/renderer/mounting/ShadowTree.cpp +153 -18
- package/ReactCommon/react/renderer/mounting/ShadowTree.h +30 -6
- package/ReactCommon/react/renderer/mounting/ShadowTreeDelegate.h +11 -0
- package/ReactCommon/react/renderer/mounting/ShadowView.cpp +0 -4
- package/ReactCommon/react/renderer/mounting/ShadowView.h +0 -1
- package/ReactCommon/react/renderer/mounting/internal/DiffMap.h +170 -0
- package/ReactCommon/react/renderer/mounting/internal/ShadowViewNodePair.h +0 -5
- package/ReactCommon/react/renderer/mounting/internal/sliceChildShadowNodeViewPairs.h +3 -3
- package/ReactCommon/react/renderer/mounting/stubs/StubView.cpp +0 -4
- package/ReactCommon/react/renderer/mounting/stubs/StubView.h +0 -1
- package/ReactCommon/react/renderer/mounting/stubs/StubViewTree.cpp +0 -4
- package/ReactCommon/react/renderer/mounting/stubs/StubViewTree.h +0 -2
- package/ReactCommon/react/renderer/mounting/tests/StateReconciliationTest.cpp +6 -0
- package/ReactCommon/react/renderer/mounting/updateMountedFlag.cpp +12 -4
- package/ReactCommon/react/renderer/observers/intersection/IntersectionObserver.cpp +2 -1
- package/ReactCommon/react/renderer/observers/intersection/IntersectionObserverState.cpp +0 -5
- package/ReactCommon/react/renderer/observers/intersection/IntersectionObserverState.h +0 -1
- package/ReactCommon/react/renderer/runtimescheduler/tests/RuntimeSchedulerTest.cpp +1 -1
- package/ReactCommon/react/renderer/scheduler/CMakeLists.txt +1 -0
- package/ReactCommon/react/renderer/scheduler/Scheduler.cpp +28 -1
- package/ReactCommon/react/renderer/scheduler/Scheduler.h +2 -2
- package/ReactCommon/react/renderer/scheduler/SchedulerDelegate.h +6 -0
- package/ReactCommon/react/renderer/scheduler/SchedulerToolbox.h +7 -0
- package/ReactCommon/react/renderer/scheduler/SurfaceHandler.cpp +2 -2
- package/ReactCommon/react/renderer/textlayoutmanager/TextLayoutManagerExtended.h +18 -18
- package/ReactCommon/react/renderer/textlayoutmanager/platform/android/react/renderer/textlayoutmanager/TextLayoutManager.cpp +8 -7
- package/ReactCommon/react/renderer/textlayoutmanager/platform/android/react/renderer/textlayoutmanager/TextLayoutManager.h +5 -5
- package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.h +3 -3
- package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm +4 -3
- package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTTextLayoutManager.h +1 -1
- package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTTextLayoutManager.mm +15 -5
- package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTTextPrimitivesConversions.h +2 -2
- package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/TextLayoutManager.mm +10 -1
- package/ReactCommon/react/renderer/uimanager/PointerEventsProcessor.cpp +1 -1
- package/ReactCommon/react/renderer/uimanager/PointerEventsProcessor.h +1 -3
- package/ReactCommon/react/renderer/uimanager/PointerHoverTracker.cpp +1 -1
- package/ReactCommon/react/renderer/uimanager/UIManager.cpp +68 -38
- package/ReactCommon/react/renderer/uimanager/UIManager.h +17 -8
- package/ReactCommon/react/renderer/uimanager/UIManagerAnimationBackend.h +17 -5
- package/ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp +2 -2
- package/ReactCommon/react/renderer/uimanager/UIManagerBinding.h +2 -2
- package/ReactCommon/react/renderer/uimanager/UIManagerDelegate.h +10 -0
- package/ReactCommon/react/renderer/uimanager/consistency/LazyShadowTreeRevisionConsistencyManager.cpp +19 -23
- package/ReactCommon/react/renderer/uimanager/consistency/LazyShadowTreeRevisionConsistencyManager.h +2 -3
- package/ReactCommon/react/renderer/uimanager/consistency/tests/LazyShadowTreeRevisionConsistencyManagerTest.cpp +13 -5
- package/ReactCommon/react/renderer/uimanager/primitives.h +16 -7
- package/ReactCommon/react/renderer/uimanager/tests/FindShadowNodeByTagTest.cpp +287 -0
- package/ReactCommon/react/runtime/TimerManager.cpp +16 -2
- package/ReactCommon/react/runtime/hermes/HermesInstance.cpp +11 -6
- package/ReactCommon/react/runtime/iostests/RCTHostTests.mm +11 -0
- package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHost.h +17 -3
- package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHost.mm +8 -1
- package/ReactCommon/react/test_utils/shadowTreeGeneration.h +8 -5
- package/ReactCommon/react/utils/ContextContainer.h +0 -2
- package/ReactCommon/yoga/yoga/YGNode.cpp +14 -0
- package/ReactCommon/yoga/yoga/YGValue.h +0 -4
- package/ReactCommon/yoga/yoga/algorithm/CalculateLayout.cpp +7 -7
- package/ReactCommon/yoga/yoga/enums/YogaEnums.h +0 -1
- package/ReactCommon/yoga/yoga/node/LayoutResults.h +0 -3
- package/ReactCommon/yoga/yoga/numeric/FloatOptional.h +0 -9
- package/ReactCommon/yoga/yoga/style/Style.h +0 -4
- package/flow/bom.js.flow +18 -17
- package/flow/dom.js.flow +12 -5
- package/flow/global.js +1 -1
- package/gradle/libs.versions.toml +1 -1
- package/index.js +9 -0
- package/index.js.flow +8 -1
- package/jest-preset.js +14 -18
- package/package.json +17 -17
- package/react-native.config.js +17 -0
- package/scripts/cocoapods/rncore.rb +111 -2
- package/scripts/cocoapods/utils.rb +2 -0
- package/scripts/codegen/templates/Package.swift.template +7 -0
- package/scripts/react_native_pods.rb +13 -6
- package/scripts/replace-rncore-version.js +12 -3
- package/sdks/.hermesv1version +1 -1
- package/sdks/.hermesversion +1 -1
- package/sdks/hermes-engine/version.properties +2 -2
- package/settings.gradle.kts +21 -1
- package/src/private/animated/NativeAnimatedHelper.js +2 -2
- package/src/private/animated/createAnimatedPropsMemoHook.js +19 -19
- package/src/private/components/virtualview/VirtualView.js +14 -21
- package/src/private/components/virtualview/VirtualViewExperimentalNativeComponent.js +11 -10
- package/src/private/components/virtualview/VirtualViewNativeComponent.js +4 -4
- package/src/private/devsupport/devmenu/elementinspector/BorderBox.js +2 -2
- package/src/private/devsupport/devmenu/elementinspector/BoxInspector.js +3 -3
- package/src/private/devsupport/devmenu/elementinspector/ElementBox.js +4 -4
- package/src/private/devsupport/devmenu/elementinspector/ElementProperties.js +1 -1
- package/src/private/devsupport/devmenu/elementinspector/Inspector.js +39 -17
- package/src/private/devsupport/devmenu/elementinspector/InspectorOverlay.js +15 -3
- package/src/private/devsupport/devmenu/elementinspector/InspectorPanel.js +2 -2
- package/src/private/devsupport/devmenu/elementinspector/ReactDevToolsOverlay.js +2 -8
- package/src/private/devsupport/devmenu/elementinspector/StyleInspector.js +1 -1
- package/src/private/devsupport/devmenu/elementinspector/resolveBoxStyle.js +1 -1
- package/src/private/devsupport/devmenu/elementinspector/useExternalInspection.js +102 -0
- package/src/private/devsupport/rndevtools/FuseboxSessionObserver.js +12 -25
- package/src/private/devsupport/rndevtools/GlobalStateObserver.js +56 -0
- package/src/private/devsupport/rndevtools/TracingStateObserver.js +28 -0
- package/src/private/featureflags/ReactNativeFeatureFlags.js +49 -82
- package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +2 -2
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +9 -12
- package/src/private/specs_DEPRECATED/components/ActivityIndicatorViewNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/AndroidDrawerLayoutNativeComponent.js +3 -3
- package/src/private/specs_DEPRECATED/components/AndroidHorizontalScrollContentViewNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/AndroidSwipeRefreshLayoutNativeComponent.js +2 -2
- package/src/private/specs_DEPRECATED/components/AndroidSwitchNativeComponent.js +2 -2
- package/src/private/specs_DEPRECATED/components/DebuggingOverlayNativeComponent.js +3 -3
- package/src/private/specs_DEPRECATED/components/ProgressBarAndroidNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/PullToRefreshViewNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/RCTInputAccessoryViewNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/RCTModalHostViewNativeComponent.js +3 -3
- package/src/private/specs_DEPRECATED/components/RCTSafeAreaViewNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/SwitchNativeComponent.js +2 -2
- package/src/private/specs_DEPRECATED/components/UnimplementedNativeViewNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/modules/NativeImageLoaderIOS.js +1 -1
- package/src/private/styles/composeStyles.js +1 -1
- package/src/private/utilities/toError.js +27 -0
- package/src/private/utilities/toExtendedError.js +30 -0
- package/src/private/webapis/dom/events/Event.js +1 -1
- package/src/private/webapis/dom/events/EventHandlerAttributes.js +2 -2
- package/src/private/webapis/dom/events/EventTarget.js +3 -3
- package/src/private/webapis/dom/events/internals/EventInternals.js +2 -2
- package/src/private/webapis/dom/nodes/ReadOnlyElement.js +1 -1
- package/src/private/webapis/dom/nodes/ReadOnlyNode.js +2 -2
- package/src/private/webapis/dom/nodes/specs/NativeDOM.js +14 -14
- package/src/private/webapis/dom/oldstylecollections/HTMLCollection.js +2 -2
- package/src/private/webapis/dom/oldstylecollections/HTMLCollection.js.flow +1 -1
- package/src/private/webapis/dom/oldstylecollections/NodeList.js +2 -2
- package/src/private/webapis/dom/oldstylecollections/NodeList.js.flow +1 -1
- package/src/private/webapis/geometry/DOMRectList.js +2 -2
- package/src/private/webapis/geometry/DOMRectList.js.flow +1 -1
- package/src/private/webapis/intersectionobserver/IntersectionObserver.js +8 -8
- package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +6 -6
- package/src/private/webapis/mutationobserver/MutationObserver.js +2 -2
- package/src/private/webapis/mutationobserver/MutationRecord.js +2 -2
- package/src/private/webapis/mutationobserver/internals/MutationObserverManager.js +1 -1
- package/src/private/webapis/mutationobserver/specs/NativeMutationObserver.js +3 -3
- package/src/private/webapis/performance/LongTasks.js +3 -3
- package/src/private/webapis/performance/Performance.js +4 -4
- package/src/private/webapis/performance/PerformanceEntry.js +1 -1
- package/src/private/webapis/performance/PerformanceObserver.js +2 -2
- package/src/private/webapis/performance/specs/NativePerformance.js +8 -8
- package/src/private/webapis/structuredClone/structuredClone.js +2 -2
- package/src/types/globals.d.ts +4 -4
- package/third-party-podspecs/RCT-Folly.podspec +1 -1
- package/third-party-podspecs/fmt.podspec +2 -2
- package/tvosCommands.js +51 -0
- package/types/index.d.ts +2 -0
- package/types/public/ReactNativeTVTypes.d.ts +27 -2
- package/Libraries/Components/View/ReactNativeViewAttributes.js +0 -60
- package/Libraries/Image/TextInlineImageNativeComponent.js +0 -49
- package/React/Fabric/Mounting/ComponentViews/VirtualViewExperimental/RCTVirtualViewExperimentalComponentView.h +0 -25
- package/React/Fabric/Mounting/ComponentViews/VirtualViewExperimental/RCTVirtualViewExperimentalComponentView.mm +0 -321
- package/ReactAndroid/src/main/java/com/facebook/react/bridge/CatalystInstanceImpl.java +0 -620
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/SurfaceMountingManager.java +0 -1411
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/LayoutShadowNode.java +0 -985
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyOptimizer.java +0 -403
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/EventDispatcherImpl.kt +0 -336
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/EventEmitterImpl.kt +0 -135
- package/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ProgressBarShadowNode.kt +0 -81
- package/ReactAndroid/src/main/java/com/facebook/react/views/switchview/ReactSwitchShadowNode.kt +0 -72
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactBaseTextShadowNode.kt +0 -677
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextAnchorViewManager.kt +0 -218
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextShadowNode.kt +0 -369
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/frescosupport/FrescoBasedReactTextInlineImageShadowNode.kt +0 -156
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/frescosupport/FrescoBasedReactTextInlineImageSpan.kt +0 -174
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/frescosupport/FrescoBasedReactTextInlineImageViewManager.kt +0 -54
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/ReactTextInlineImageShadowNode.kt +0 -30
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/TextInlineImageSpan.kt +0 -58
- package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputShadowNode.kt +0 -228
- package/ReactAndroid/src/main/java/com/facebook/react/views/virtual/viewexperimental/ReactVirtualViewExperimental.kt +0 -305
- package/ReactAndroid/src/main/java/com/facebook/react/views/virtual/viewexperimental/ReactVirtualViewExperimentalManager.kt +0 -110
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaConfigJNIBase.java +0 -62
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaDirection.java +0 -35
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaNode.java +0 -279
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaProps.java +0 -197
- package/ReactAndroid/src/main/jni/react/jni/CatalystInstanceImpl.cpp +0 -410
- package/ReactAndroid/src/main/jni/react/jni/CatalystInstanceImpl.h +0 -113
- package/ReactCommon/react/renderer/components/virtualviewexperimental/VirtualViewExperimentalComponentDescriptor.h +0 -19
- package/ReactCommon/react/renderer/components/virtualviewexperimental/VirtualViewExperimentalShadowNode.h +0 -38
- package/jest/MockNativeMethods.js +0 -27
- package/jest/RefreshControlMock.js +0 -32
- package/jest/assetFileTransformer.js +0 -33
- package/jest/local-setup.js +0 -29
- package/jest/mock.js +0 -39
- package/jest/mockComponent.js +0 -104
- package/jest/mockNativeComponent.js +0 -52
- package/jest/mocks/AccessibilityInfo.js +0 -62
- package/jest/mocks/ActivityIndicator.js +0 -23
- package/jest/mocks/AppState.js +0 -19
- package/jest/mocks/Image.js +0 -23
- package/jest/mocks/InitializeCore.js +0 -9
- package/jest/mocks/Linking.js +0 -28
- package/jest/mocks/Modal.js +0 -33
- package/jest/mocks/NativeComponentRegistry.js +0 -30
- package/jest/mocks/NativeModules.js +0 -239
- package/jest/mocks/RefreshControl.js +0 -31
- package/jest/mocks/RendererProxy.js +0 -45
- package/jest/mocks/ScrollView.js +0 -58
- package/jest/mocks/Text.js +0 -27
- package/jest/mocks/TextInput.js +0 -32
- package/jest/mocks/UIManager.js +0 -60
- package/jest/mocks/View.js +0 -27
- package/jest/mocks/ViewNativeComponent.js +0 -23
- package/jest/mocks/requireNativeComponent.js +0 -22
- package/jest/mocks/useColorScheme.js +0 -18
- package/jest/react-native-env.js +0 -17
- package/jest/renderer.js +0 -40
- package/jest/resolver.js +0 -32
- package/jest/setup.js +0 -140
- /package/React/Fabric/Mounting/ComponentViews/{VirtualViewExperimental → VirtualView}/RCTVirtualViewMode.h +0 -0
- /package/React/Fabric/Mounting/ComponentViews/{VirtualViewExperimental → VirtualView}/RCTVirtualViewRenderState.h +0 -0
- /package/ReactAndroid/src/main/java/com/facebook/react/fabric/internal/interop/{InteropUiBlockListener.kt → InteropUIBlockListener.kt} +0 -0
- /package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/{LegacyViewManagerInteropComponentDescriptor.h → platform/ios/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropComponentDescriptor.h} +0 -0
- /package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/{RCTLegacyViewManagerInteropCoordinator.h → platform/ios/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.h} +0 -0
- /package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/{RCTLegacyViewManagerInteropCoordinator.mm → platform/ios/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.mm} +0 -0
- /package/ReactCommon/react/renderer/components/scrollview/{RCTComponentViewHelpers.h → platform/ios/react/renderer/components/scrollview/RCTComponentViewHelpers.h} +0 -0
|
@@ -0,0 +1,1647 @@
|
|
|
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
|
+
* @generated SignedSource<<fefaf14f0291216b635ea0c356e9929c>>
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* THIS FILE IS GENERATED - DO NOT EDIT DIRECTLY
|
|
12
|
+
* Source: ReactScrollView.java
|
|
13
|
+
* Run: node generate-nested-scroll-view.js
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
package com.facebook.react.views.scroll;
|
|
17
|
+
|
|
18
|
+
import static com.facebook.react.views.scroll.ReactScrollViewHelper.SNAP_ALIGNMENT_CENTER;
|
|
19
|
+
import static com.facebook.react.views.scroll.ReactScrollViewHelper.SNAP_ALIGNMENT_DISABLED;
|
|
20
|
+
import static com.facebook.react.views.scroll.ReactScrollViewHelper.SNAP_ALIGNMENT_END;
|
|
21
|
+
import static com.facebook.react.views.scroll.ReactScrollViewHelper.SNAP_ALIGNMENT_START;
|
|
22
|
+
import static com.facebook.react.views.scroll.ReactScrollViewHelper.findNextFocusableView;
|
|
23
|
+
|
|
24
|
+
import android.animation.ObjectAnimator;
|
|
25
|
+
import android.animation.ValueAnimator;
|
|
26
|
+
import android.content.Context;
|
|
27
|
+
import android.graphics.Canvas;
|
|
28
|
+
import android.graphics.Color;
|
|
29
|
+
import android.graphics.Point;
|
|
30
|
+
import android.graphics.Rect;
|
|
31
|
+
import android.graphics.drawable.ColorDrawable;
|
|
32
|
+
import android.graphics.drawable.Drawable;
|
|
33
|
+
import android.os.Build;
|
|
34
|
+
import android.view.KeyEvent;
|
|
35
|
+
import android.view.MotionEvent;
|
|
36
|
+
import android.view.View;
|
|
37
|
+
import android.view.ViewGroup;
|
|
38
|
+
import android.view.accessibility.AccessibilityNodeInfo;
|
|
39
|
+
import android.widget.OverScroller;
|
|
40
|
+
import androidx.core.widget.NestedScrollView;
|
|
41
|
+
import androidx.annotation.NonNull;
|
|
42
|
+
import androidx.annotation.Nullable;
|
|
43
|
+
import androidx.core.view.ViewCompat;
|
|
44
|
+
import androidx.core.view.ViewCompat.FocusDirection;
|
|
45
|
+
import com.facebook.common.logging.FLog;
|
|
46
|
+
import com.facebook.infer.annotation.Assertions;
|
|
47
|
+
import com.facebook.infer.annotation.Nullsafe;
|
|
48
|
+
import com.facebook.react.R;
|
|
49
|
+
import com.facebook.react.bridge.ReadableMap;
|
|
50
|
+
import com.facebook.react.common.ReactConstants;
|
|
51
|
+
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags;
|
|
52
|
+
import com.facebook.react.uimanager.BackgroundStyleApplicator;
|
|
53
|
+
import com.facebook.react.uimanager.LengthPercentage;
|
|
54
|
+
import com.facebook.react.uimanager.LengthPercentageType;
|
|
55
|
+
import com.facebook.react.uimanager.MeasureSpecAssertions;
|
|
56
|
+
import com.facebook.react.uimanager.PixelUtil;
|
|
57
|
+
import com.facebook.react.uimanager.PointerEvents;
|
|
58
|
+
import com.facebook.react.uimanager.ReactClippingViewGroup;
|
|
59
|
+
import com.facebook.react.uimanager.ReactClippingViewGroupHelper;
|
|
60
|
+
import com.facebook.react.uimanager.ReactOverflowViewWithInset;
|
|
61
|
+
import com.facebook.react.uimanager.StateWrapper;
|
|
62
|
+
import com.facebook.react.uimanager.events.NativeGestureUtil;
|
|
63
|
+
import com.facebook.react.uimanager.style.BorderRadiusProp;
|
|
64
|
+
import com.facebook.react.uimanager.style.BorderStyle;
|
|
65
|
+
import com.facebook.react.uimanager.style.LogicalEdge;
|
|
66
|
+
import com.facebook.react.uimanager.style.Overflow;
|
|
67
|
+
import com.facebook.react.views.scroll.ReactScrollViewHelper.HasFlingAnimator;
|
|
68
|
+
import com.facebook.react.views.scroll.ReactScrollViewHelper.HasScrollEventThrottle;
|
|
69
|
+
import com.facebook.react.views.scroll.ReactScrollViewHelper.HasScrollState;
|
|
70
|
+
import com.facebook.react.views.scroll.ReactScrollViewHelper.HasSmoothScroll;
|
|
71
|
+
import com.facebook.react.views.scroll.ReactScrollViewHelper.HasStateWrapper;
|
|
72
|
+
import com.facebook.react.views.scroll.ReactScrollViewHelper.ReactScrollViewScrollState;
|
|
73
|
+
import com.facebook.systrace.Systrace;
|
|
74
|
+
import java.lang.reflect.Field;
|
|
75
|
+
import java.util.List;
|
|
76
|
+
import java.util.Set;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* A simple subclass of NestedScrollView that doesn't dispatch measure and layout to its children and has
|
|
80
|
+
* a scroll listener to send scroll events to JS.
|
|
81
|
+
*
|
|
82
|
+
* <p>ReactNestedScrollView only supports vertical scrolling. For horizontal scrolling, use {@link
|
|
83
|
+
* ReactHorizontalScrollView}.
|
|
84
|
+
*/
|
|
85
|
+
@Nullsafe(Nullsafe.Mode.LOCAL)
|
|
86
|
+
class ReactNestedScrollView extends NestedScrollView
|
|
87
|
+
implements ReactClippingViewGroup,
|
|
88
|
+
ViewGroup.OnHierarchyChangeListener,
|
|
89
|
+
View.OnLayoutChangeListener,
|
|
90
|
+
ReactAccessibleScrollView,
|
|
91
|
+
ReactOverflowViewWithInset,
|
|
92
|
+
HasScrollState,
|
|
93
|
+
HasStateWrapper,
|
|
94
|
+
HasFlingAnimator,
|
|
95
|
+
HasScrollEventThrottle,
|
|
96
|
+
HasSmoothScroll,
|
|
97
|
+
VirtualViewContainer {
|
|
98
|
+
|
|
99
|
+
private static @Nullable Field sScrollerField;
|
|
100
|
+
private static boolean sTriedToGetScrollerField = false;
|
|
101
|
+
|
|
102
|
+
private static final int UNSET_CONTENT_OFFSET = -1;
|
|
103
|
+
|
|
104
|
+
private final OnScrollDispatchHelper mOnScrollDispatchHelper = new OnScrollDispatchHelper();
|
|
105
|
+
private final @Nullable OverScroller mScroller;
|
|
106
|
+
private final VelocityHelper mVelocityHelper = new VelocityHelper();
|
|
107
|
+
private final Rect mTempRect = new Rect();
|
|
108
|
+
private final ValueAnimator DEFAULT_FLING_ANIMATOR = ObjectAnimator.ofInt(this, "scrollY", 0, 0);
|
|
109
|
+
|
|
110
|
+
private Rect mOverflowInset;
|
|
111
|
+
private @Nullable VirtualViewContainerState mVirtualViewContainerState;
|
|
112
|
+
private boolean mActivelyScrolling;
|
|
113
|
+
private @Nullable Rect mClippingRect;
|
|
114
|
+
private Overflow mOverflow;
|
|
115
|
+
private boolean mDragging;
|
|
116
|
+
private boolean mPagingEnabled;
|
|
117
|
+
private @Nullable Runnable mPostTouchRunnable;
|
|
118
|
+
private boolean mRemoveClippedSubviews;
|
|
119
|
+
private boolean mScrollEnabled;
|
|
120
|
+
private boolean mSendMomentumEvents;
|
|
121
|
+
private @Nullable FpsListener mFpsListener;
|
|
122
|
+
private @Nullable String mScrollPerfTag;
|
|
123
|
+
private @Nullable Drawable mEndBackground;
|
|
124
|
+
private int mEndFillColor;
|
|
125
|
+
private boolean mDisableIntervalMomentum;
|
|
126
|
+
private int mSnapInterval;
|
|
127
|
+
private @Nullable List<Integer> mSnapOffsets;
|
|
128
|
+
private boolean mSnapToStart;
|
|
129
|
+
private boolean mSnapToEnd;
|
|
130
|
+
private int mSnapToAlignment;
|
|
131
|
+
private @Nullable View mContentView;
|
|
132
|
+
private @Nullable ReadableMap mCurrentContentOffset;
|
|
133
|
+
private int mPendingContentOffsetX;
|
|
134
|
+
private int mPendingContentOffsetY;
|
|
135
|
+
private @Nullable StateWrapper mStateWrapper;
|
|
136
|
+
private ReactScrollViewScrollState mReactScrollViewScrollState;
|
|
137
|
+
private PointerEvents mPointerEvents;
|
|
138
|
+
private long mLastScrollDispatchTime;
|
|
139
|
+
private int mScrollEventThrottle;
|
|
140
|
+
private @Nullable MaintainVisibleScrollPositionHelper mMaintainVisibleContentPositionHelper;
|
|
141
|
+
private int mFadingEdgeLengthStart;
|
|
142
|
+
private int mFadingEdgeLengthEnd;
|
|
143
|
+
private boolean mEmittedOverScrollSinceScrollBegin;
|
|
144
|
+
private boolean mScrollsChildToFocus = true;
|
|
145
|
+
|
|
146
|
+
public ReactNestedScrollView(Context context) {
|
|
147
|
+
this(context, null);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
public ReactNestedScrollView(Context context, @Nullable FpsListener fpsListener) {
|
|
151
|
+
super(context);
|
|
152
|
+
mFpsListener = fpsListener;
|
|
153
|
+
|
|
154
|
+
mScroller = getOverScrollerFromParent();
|
|
155
|
+
setOnHierarchyChangeListener(this);
|
|
156
|
+
setScrollBarStyle(SCROLLBARS_OUTSIDE_OVERLAY);
|
|
157
|
+
setClipChildren(false);
|
|
158
|
+
|
|
159
|
+
ViewCompat.setAccessibilityDelegate(this, new ReactScrollViewAccessibilityDelegate());
|
|
160
|
+
initView();
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Set all default values here as opposed to in the constructor or field defaults. It is important
|
|
165
|
+
* that these properties are set during the constructor, but also on-demand whenever an existing
|
|
166
|
+
* ReactTextView is recycled.
|
|
167
|
+
*/
|
|
168
|
+
private void initView() {
|
|
169
|
+
mOverflowInset = new Rect();
|
|
170
|
+
mVirtualViewContainerState = null;
|
|
171
|
+
mActivelyScrolling = false;
|
|
172
|
+
mClippingRect = null;
|
|
173
|
+
|
|
174
|
+
// The default value for `overflow` is set to `Visible` in the Yoga style props.
|
|
175
|
+
mOverflow =
|
|
176
|
+
ReactNativeFeatureFlags.enablePropsUpdateReconciliationAndroid()
|
|
177
|
+
? Overflow.VISIBLE
|
|
178
|
+
: Overflow.SCROLL;
|
|
179
|
+
|
|
180
|
+
mDragging = false;
|
|
181
|
+
mPagingEnabled = false;
|
|
182
|
+
mPostTouchRunnable = null;
|
|
183
|
+
mRemoveClippedSubviews = false;
|
|
184
|
+
mScrollEnabled = true;
|
|
185
|
+
mSendMomentumEvents = false;
|
|
186
|
+
mScrollPerfTag = null;
|
|
187
|
+
mEndBackground = null;
|
|
188
|
+
mEndFillColor = Color.TRANSPARENT;
|
|
189
|
+
mDisableIntervalMomentum = false;
|
|
190
|
+
mSnapInterval = 0;
|
|
191
|
+
mSnapOffsets = null;
|
|
192
|
+
mSnapToStart = true;
|
|
193
|
+
mSnapToEnd = true;
|
|
194
|
+
mSnapToAlignment = SNAP_ALIGNMENT_DISABLED;
|
|
195
|
+
mContentView = null;
|
|
196
|
+
mCurrentContentOffset = null;
|
|
197
|
+
mPendingContentOffsetX = UNSET_CONTENT_OFFSET;
|
|
198
|
+
mPendingContentOffsetY = UNSET_CONTENT_OFFSET;
|
|
199
|
+
mStateWrapper = null;
|
|
200
|
+
mReactScrollViewScrollState = new ReactScrollViewScrollState();
|
|
201
|
+
mPointerEvents = PointerEvents.AUTO;
|
|
202
|
+
mLastScrollDispatchTime = 0;
|
|
203
|
+
mScrollEventThrottle = 0;
|
|
204
|
+
mMaintainVisibleContentPositionHelper = null;
|
|
205
|
+
mFadingEdgeLengthStart = 0;
|
|
206
|
+
mFadingEdgeLengthEnd = 0;
|
|
207
|
+
mEmittedOverScrollSinceScrollBegin = false;
|
|
208
|
+
mScrollsChildToFocus = true;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/* package */ void recycleView() {
|
|
212
|
+
// Set default field values
|
|
213
|
+
initView();
|
|
214
|
+
|
|
215
|
+
// If the view is still attached to a parent, we need to remove it from the parent
|
|
216
|
+
// before we can recycle it.
|
|
217
|
+
if (getParent() != null) {
|
|
218
|
+
((ViewGroup) getParent()).removeView(this);
|
|
219
|
+
}
|
|
220
|
+
updateView();
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
private void updateView() {}
|
|
224
|
+
|
|
225
|
+
@Override
|
|
226
|
+
public VirtualViewContainerState getVirtualViewContainerState() {
|
|
227
|
+
if (mVirtualViewContainerState == null) {
|
|
228
|
+
mVirtualViewContainerState = VirtualViewContainerState.create(this);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
return mVirtualViewContainerState;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
@Override
|
|
235
|
+
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
|
|
236
|
+
super.onInitializeAccessibilityNodeInfo(info);
|
|
237
|
+
|
|
238
|
+
// Expose the testID prop as the resource-id name of the view. Black-box E2E/UI testing
|
|
239
|
+
// frameworks, which interact with the UI through the accessibility framework, do not have
|
|
240
|
+
// access to view tags. This allows developers/testers to avoid polluting the
|
|
241
|
+
// content-description with test identifiers.
|
|
242
|
+
final String testId = (String) this.getTag(R.id.react_test_id);
|
|
243
|
+
if (testId != null) {
|
|
244
|
+
info.setViewIdResourceName(testId);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
@Nullable
|
|
249
|
+
protected OverScroller getOverScrollerFromParent() {
|
|
250
|
+
OverScroller scroller;
|
|
251
|
+
|
|
252
|
+
if (!sTriedToGetScrollerField) {
|
|
253
|
+
sTriedToGetScrollerField = true;
|
|
254
|
+
try {
|
|
255
|
+
sScrollerField = NestedScrollView.class.getDeclaredField("mScroller");
|
|
256
|
+
sScrollerField.setAccessible(true);
|
|
257
|
+
} catch (NoSuchFieldException e) {
|
|
258
|
+
FLog.w(
|
|
259
|
+
ReactConstants.TAG,
|
|
260
|
+
"Failed to get mScroller field for NestedScrollView! "
|
|
261
|
+
+ "This app will exhibit the bounce-back scrolling bug :(");
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
if (sScrollerField != null) {
|
|
266
|
+
try {
|
|
267
|
+
Object scrollerValue = sScrollerField.get(this);
|
|
268
|
+
if (scrollerValue instanceof OverScroller) {
|
|
269
|
+
scroller = (OverScroller) scrollerValue;
|
|
270
|
+
} else {
|
|
271
|
+
FLog.w(
|
|
272
|
+
ReactConstants.TAG,
|
|
273
|
+
"Failed to cast mScroller field in NestedScrollView (probably due to OEM changes to AOSP)! "
|
|
274
|
+
+ "This app will exhibit the bounce-back scrolling bug :(");
|
|
275
|
+
scroller = null;
|
|
276
|
+
}
|
|
277
|
+
} catch (IllegalAccessException e) {
|
|
278
|
+
throw new RuntimeException("Failed to get mScroller from NestedScrollView!", e);
|
|
279
|
+
}
|
|
280
|
+
} else {
|
|
281
|
+
scroller = null;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
return scroller;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
public void setDisableIntervalMomentum(boolean disableIntervalMomentum) {
|
|
288
|
+
mDisableIntervalMomentum = disableIntervalMomentum;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
public void setSendMomentumEvents(boolean sendMomentumEvents) {
|
|
292
|
+
mSendMomentumEvents = sendMomentumEvents;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
public void setScrollPerfTag(@Nullable String scrollPerfTag) {
|
|
296
|
+
mScrollPerfTag = scrollPerfTag;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
public void setScrollEnabled(boolean scrollEnabled) {
|
|
300
|
+
mScrollEnabled = scrollEnabled;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
public boolean getScrollEnabled() {
|
|
304
|
+
return mScrollEnabled;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
public void setPagingEnabled(boolean pagingEnabled) {
|
|
308
|
+
mPagingEnabled = pagingEnabled;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
public void setScrollsChildToFocus(boolean scrollsChildToFocus) {
|
|
312
|
+
mScrollsChildToFocus = scrollsChildToFocus;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
public void setDecelerationRate(float decelerationRate) {
|
|
316
|
+
getReactScrollViewScrollState().setDecelerationRate(decelerationRate);
|
|
317
|
+
|
|
318
|
+
if (mScroller != null) {
|
|
319
|
+
mScroller.setFriction(1.0f - decelerationRate);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
public void abortAnimation() {
|
|
324
|
+
if (mScroller != null && !mScroller.isFinished()) {
|
|
325
|
+
mScroller.abortAnimation();
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
public void setSnapInterval(int snapInterval) {
|
|
330
|
+
mSnapInterval = snapInterval;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
public void setSnapOffsets(@Nullable List<Integer> snapOffsets) {
|
|
334
|
+
mSnapOffsets = snapOffsets;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
public void setSnapToStart(boolean snapToStart) {
|
|
338
|
+
mSnapToStart = snapToStart;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
public void setSnapToEnd(boolean snapToEnd) {
|
|
342
|
+
mSnapToEnd = snapToEnd;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
public void setSnapToAlignment(int snapToAlignment) {
|
|
346
|
+
mSnapToAlignment = snapToAlignment;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
public void flashScrollIndicators() {
|
|
350
|
+
awakenScrollBars();
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
public int getFadingEdgeLengthStart() {
|
|
354
|
+
return mFadingEdgeLengthStart;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
public int getFadingEdgeLengthEnd() {
|
|
358
|
+
return mFadingEdgeLengthEnd;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
public void setFadingEdgeLengthStart(int start) {
|
|
362
|
+
mFadingEdgeLengthStart = start;
|
|
363
|
+
invalidate();
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
public void setFadingEdgeLengthEnd(int end) {
|
|
367
|
+
mFadingEdgeLengthEnd = end;
|
|
368
|
+
invalidate();
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
@Override
|
|
372
|
+
protected float getTopFadingEdgeStrength() {
|
|
373
|
+
float max = Math.max(mFadingEdgeLengthStart, mFadingEdgeLengthEnd);
|
|
374
|
+
return (mFadingEdgeLengthStart / max);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
@Override
|
|
378
|
+
protected float getBottomFadingEdgeStrength() {
|
|
379
|
+
float max = Math.max(mFadingEdgeLengthStart, mFadingEdgeLengthEnd);
|
|
380
|
+
return (mFadingEdgeLengthEnd / max);
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
public void setOverflow(@Nullable String overflow) {
|
|
384
|
+
if (overflow == null) {
|
|
385
|
+
mOverflow = Overflow.SCROLL;
|
|
386
|
+
} else {
|
|
387
|
+
@Nullable Overflow parsedOverflow = Overflow.fromString(overflow);
|
|
388
|
+
mOverflow =
|
|
389
|
+
parsedOverflow == null
|
|
390
|
+
? (ReactNativeFeatureFlags.enablePropsUpdateReconciliationAndroid()
|
|
391
|
+
? Overflow.VISIBLE
|
|
392
|
+
: Overflow.SCROLL)
|
|
393
|
+
: parsedOverflow;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
invalidate();
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
public void setMaintainVisibleContentPosition(
|
|
400
|
+
@Nullable MaintainVisibleScrollPositionHelper.Config config) {
|
|
401
|
+
if (config != null && mMaintainVisibleContentPositionHelper == null) {
|
|
402
|
+
mMaintainVisibleContentPositionHelper = new MaintainVisibleScrollPositionHelper(this, false);
|
|
403
|
+
mMaintainVisibleContentPositionHelper.start();
|
|
404
|
+
} else if (config == null && mMaintainVisibleContentPositionHelper != null) {
|
|
405
|
+
mMaintainVisibleContentPositionHelper.stop();
|
|
406
|
+
mMaintainVisibleContentPositionHelper = null;
|
|
407
|
+
}
|
|
408
|
+
if (mMaintainVisibleContentPositionHelper != null) {
|
|
409
|
+
mMaintainVisibleContentPositionHelper.setConfig(config);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
@Override
|
|
414
|
+
public @Nullable String getOverflow() {
|
|
415
|
+
switch (mOverflow) {
|
|
416
|
+
case HIDDEN:
|
|
417
|
+
return "hidden";
|
|
418
|
+
case SCROLL:
|
|
419
|
+
return "scroll";
|
|
420
|
+
case VISIBLE:
|
|
421
|
+
return "visible";
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
return null;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
@Override
|
|
428
|
+
public void setOverflowInset(int left, int top, int right, int bottom) {
|
|
429
|
+
mOverflowInset.set(left, top, right, bottom);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
@Override
|
|
433
|
+
public Rect getOverflowInset() {
|
|
434
|
+
return mOverflowInset;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
@Override
|
|
438
|
+
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
|
439
|
+
MeasureSpecAssertions.assertExplicitMeasureSpec(widthMeasureSpec, heightMeasureSpec);
|
|
440
|
+
|
|
441
|
+
setMeasuredDimension(
|
|
442
|
+
MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.getSize(heightMeasureSpec));
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
@Override
|
|
446
|
+
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
|
447
|
+
// Apply pending contentOffset in case it was set before the view was laid out.
|
|
448
|
+
if (isContentReady()) {
|
|
449
|
+
// If a "pending" content offset value has been set, we restore that value.
|
|
450
|
+
// Upon call to scrollTo, the "pending" values will be re-set.
|
|
451
|
+
int scrollToX =
|
|
452
|
+
mPendingContentOffsetX != UNSET_CONTENT_OFFSET ? mPendingContentOffsetX : getScrollX();
|
|
453
|
+
int scrollToY =
|
|
454
|
+
mPendingContentOffsetY != UNSET_CONTENT_OFFSET ? mPendingContentOffsetY : getScrollY();
|
|
455
|
+
scrollTo(scrollToX, scrollToY);
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
ReactScrollViewHelper.emitLayoutEvent(this);
|
|
459
|
+
if (mVirtualViewContainerState != null) {
|
|
460
|
+
mVirtualViewContainerState.updateState();
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
@Override
|
|
465
|
+
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
|
|
466
|
+
super.onSizeChanged(w, h, oldw, oldh);
|
|
467
|
+
if (mRemoveClippedSubviews) {
|
|
468
|
+
updateClippingRect();
|
|
469
|
+
}
|
|
470
|
+
if (mVirtualViewContainerState != null) {
|
|
471
|
+
mVirtualViewContainerState.updateState();
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
@Override
|
|
476
|
+
public void onAttachedToWindow() {
|
|
477
|
+
super.onAttachedToWindow();
|
|
478
|
+
if (mRemoveClippedSubviews) {
|
|
479
|
+
updateClippingRect();
|
|
480
|
+
}
|
|
481
|
+
if (mMaintainVisibleContentPositionHelper != null) {
|
|
482
|
+
mMaintainVisibleContentPositionHelper.start();
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
@Override
|
|
487
|
+
protected void onDetachedFromWindow() {
|
|
488
|
+
super.onDetachedFromWindow();
|
|
489
|
+
if (mMaintainVisibleContentPositionHelper != null) {
|
|
490
|
+
mMaintainVisibleContentPositionHelper.stop();
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
@Override
|
|
495
|
+
public @Nullable View focusSearch(View focused, @FocusDirection int direction) {
|
|
496
|
+
View nextFocus = super.focusSearch(focused, direction);
|
|
497
|
+
|
|
498
|
+
if (ReactNativeFeatureFlags.enableCustomFocusSearchOnClippedElementsAndroid()) {
|
|
499
|
+
// If we can find the next focus and it is a child of this view, return it, else it means we
|
|
500
|
+
// are leaving the scroll view and we should try to find a clipped element
|
|
501
|
+
if (nextFocus != null && this.findViewById(nextFocus.getId()) != null) {
|
|
502
|
+
return nextFocus;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
@Nullable View nextfocusableView = findNextFocusableView(this, focused, direction);
|
|
506
|
+
|
|
507
|
+
if (nextfocusableView != null) {
|
|
508
|
+
return nextfocusableView;
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
return nextFocus;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
/**
|
|
516
|
+
* Since ReactNestedScrollView handles layout changes on JS side, it does not call super.onlayout due to
|
|
517
|
+
* which mIsLayoutDirty flag in NestedScrollView remains true and prevents scrolling to child when
|
|
518
|
+
* requestChildFocus is called. Overriding this method and scrolling to child without checking any
|
|
519
|
+
* layout dirty flag. This will fix focus navigation issue for KeyEvents which are not handled by
|
|
520
|
+
* NestedScrollView, for example: KEYCODE_TAB.
|
|
521
|
+
*/
|
|
522
|
+
@Override
|
|
523
|
+
public void requestChildFocus(View child, View focused) {
|
|
524
|
+
if (focused != null && mScrollsChildToFocus) {
|
|
525
|
+
scrollToChild(focused);
|
|
526
|
+
}
|
|
527
|
+
requestChildFocusWithoutScroll(child, focused);
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* In rare cases where an app overrides the built-in ReactNestedScrollView by overriding it, and also
|
|
532
|
+
* needs to customize scroll into view on focus behaviors, this protected method can be used to
|
|
533
|
+
* unblocks such customization.
|
|
534
|
+
*/
|
|
535
|
+
protected void requestChildFocusWithoutScroll(View child, View focused) {
|
|
536
|
+
super.requestChildFocus(child, focused);
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
@Override
|
|
540
|
+
public boolean requestChildRectangleOnScreen(View child, Rect rectangle, boolean immediate) {
|
|
541
|
+
if (!mScrollsChildToFocus) {
|
|
542
|
+
return false;
|
|
543
|
+
}
|
|
544
|
+
return super.requestChildRectangleOnScreen(child, rectangle, immediate);
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
private int getScrollDelta(View descendent) {
|
|
548
|
+
descendent.getDrawingRect(mTempRect);
|
|
549
|
+
offsetDescendantRectToMyCoords(descendent, mTempRect);
|
|
550
|
+
return computeScrollDeltaToGetChildRectOnScreen(mTempRect);
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
/** Returns whether the given descendent is partially scrolled in view */
|
|
554
|
+
@Override
|
|
555
|
+
public boolean isPartiallyScrolledInView(View descendent) {
|
|
556
|
+
int scrollDelta = getScrollDelta(descendent);
|
|
557
|
+
descendent.getDrawingRect(mTempRect);
|
|
558
|
+
return scrollDelta != 0 && Math.abs(scrollDelta) < mTempRect.width();
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
private void scrollToChild(View child) {
|
|
562
|
+
// Only scroll the nearest ReactNestedScrollView ancestor into view, rather than the focused child.
|
|
563
|
+
// Nested NestedScrollView instances will handle scrolling the child into their respective viewports.
|
|
564
|
+
View parent = child;
|
|
565
|
+
View scrollViewAncestor = null;
|
|
566
|
+
while (parent != null && parent != this) {
|
|
567
|
+
if (parent instanceof ReactNestedScrollView) {
|
|
568
|
+
scrollViewAncestor = parent;
|
|
569
|
+
}
|
|
570
|
+
parent = (View) parent.getParent();
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
View scrollIntoViewTarget = scrollViewAncestor != null ? scrollViewAncestor : child;
|
|
574
|
+
|
|
575
|
+
Rect tempRect = new Rect();
|
|
576
|
+
scrollIntoViewTarget.getDrawingRect(tempRect);
|
|
577
|
+
|
|
578
|
+
/* Offset from child's local coordinates to NestedScrollView coordinates */
|
|
579
|
+
offsetDescendantRectToMyCoords(scrollIntoViewTarget, tempRect);
|
|
580
|
+
|
|
581
|
+
int scrollDelta = computeScrollDeltaToGetChildRectOnScreen(tempRect);
|
|
582
|
+
|
|
583
|
+
if (scrollDelta != 0) {
|
|
584
|
+
scrollBy(0, scrollDelta);
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
@Override
|
|
589
|
+
protected void onScrollChanged(int x, int y, int oldX, int oldY) {
|
|
590
|
+
Systrace.beginSection(Systrace.TRACE_TAG_REACT, "ReactNestedScrollView.onScrollChanged");
|
|
591
|
+
try {
|
|
592
|
+
super.onScrollChanged(x, y, oldX, oldY);
|
|
593
|
+
|
|
594
|
+
mActivelyScrolling = true;
|
|
595
|
+
|
|
596
|
+
if (mOnScrollDispatchHelper.onScrollChanged(x, y)) {
|
|
597
|
+
if (mRemoveClippedSubviews) {
|
|
598
|
+
updateClippingRect();
|
|
599
|
+
}
|
|
600
|
+
ReactScrollViewHelper.updateStateOnScrollChanged(
|
|
601
|
+
this,
|
|
602
|
+
mOnScrollDispatchHelper.getXFlingVelocity(),
|
|
603
|
+
mOnScrollDispatchHelper.getYFlingVelocity());
|
|
604
|
+
if (mVirtualViewContainerState != null) {
|
|
605
|
+
mVirtualViewContainerState.updateState();
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
} finally {
|
|
609
|
+
Systrace.endSection(Systrace.TRACE_TAG_REACT);
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
@Override
|
|
614
|
+
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
|
615
|
+
if (!mScrollEnabled) {
|
|
616
|
+
return false;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
// We intercept the touch event if the children are not supposed to receive it.
|
|
620
|
+
if (!PointerEvents.canChildrenBeTouchTarget(mPointerEvents)) {
|
|
621
|
+
return true;
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
try {
|
|
625
|
+
if (super.onInterceptTouchEvent(ev)) {
|
|
626
|
+
handleInterceptedTouchEvent(ev);
|
|
627
|
+
return true;
|
|
628
|
+
}
|
|
629
|
+
} catch (IllegalArgumentException e) {
|
|
630
|
+
// Log and ignore the error. This seems to be a bug in the android SDK and
|
|
631
|
+
// this is the commonly accepted workaround.
|
|
632
|
+
// https://tinyurl.com/mw6qkod (Stack Overflow)
|
|
633
|
+
FLog.w(ReactConstants.TAG, "Error intercepting touch event.", e);
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
return false;
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
protected void handleInterceptedTouchEvent(MotionEvent ev) {
|
|
640
|
+
if (!ReactNativeFeatureFlags.shouldTriggerResponderTransferOnScrollAndroid()) {
|
|
641
|
+
NativeGestureUtil.notifyNativeGestureStarted(this, ev);
|
|
642
|
+
}
|
|
643
|
+
ReactScrollViewHelper.emitScrollBeginDragEvent(this);
|
|
644
|
+
mDragging = true;
|
|
645
|
+
mEmittedOverScrollSinceScrollBegin = false;
|
|
646
|
+
enableFpsListener();
|
|
647
|
+
getFlingAnimator().cancel();
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
@Override
|
|
651
|
+
public boolean onTouchEvent(MotionEvent ev) {
|
|
652
|
+
if (!mScrollEnabled) {
|
|
653
|
+
return false;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
// We do not accept the touch event if this view is not supposed to receive it.
|
|
657
|
+
if (!PointerEvents.canBeTouchTarget(mPointerEvents)) {
|
|
658
|
+
return false;
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
mVelocityHelper.calculateVelocity(ev);
|
|
662
|
+
int action = ev.getActionMasked();
|
|
663
|
+
if (action == MotionEvent.ACTION_UP && mDragging) {
|
|
664
|
+
ReactScrollViewHelper.updateFabricScrollState(this);
|
|
665
|
+
|
|
666
|
+
float velocityX = mVelocityHelper.getXVelocity();
|
|
667
|
+
float velocityY = mVelocityHelper.getYVelocity();
|
|
668
|
+
ReactScrollViewHelper.emitScrollEndDragEvent(this, velocityX, velocityY);
|
|
669
|
+
if (!ReactNativeFeatureFlags.shouldTriggerResponderTransferOnScrollAndroid()) {
|
|
670
|
+
NativeGestureUtil.notifyNativeGestureEnded(this, ev);
|
|
671
|
+
}
|
|
672
|
+
mDragging = false;
|
|
673
|
+
// After the touch finishes, we may need to do some scrolling afterwards either as a result
|
|
674
|
+
// of a fling or because we need to page align the content
|
|
675
|
+
handlePostTouchScrolling(Math.round(velocityX), Math.round(velocityY));
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
if (action == MotionEvent.ACTION_DOWN) {
|
|
679
|
+
cancelPostTouchScrolling();
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
return super.onTouchEvent(ev);
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
@Override
|
|
686
|
+
public boolean dispatchGenericMotionEvent(MotionEvent ev) {
|
|
687
|
+
// Ignore generic motion events (joystick, mouse wheel, trackpad) if scrolling is disabled
|
|
688
|
+
if (!mScrollEnabled) {
|
|
689
|
+
return false;
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
// We do not dispatch the motion event if its children are not supposed to receive it
|
|
693
|
+
if (!PointerEvents.canChildrenBeTouchTarget(mPointerEvents)) {
|
|
694
|
+
return false;
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
// Handle ACTION_SCROLL events (mouse wheel, trackpad, joystick)
|
|
698
|
+
if (ev.getActionMasked() == MotionEvent.ACTION_SCROLL) {
|
|
699
|
+
float vScroll = ev.getAxisValue(MotionEvent.AXIS_VSCROLL);
|
|
700
|
+
if (vScroll != 0) {
|
|
701
|
+
// Perform the scroll
|
|
702
|
+
boolean result = super.dispatchGenericMotionEvent(ev);
|
|
703
|
+
// Schedule snap alignment to run after scrolling stops
|
|
704
|
+
if (result
|
|
705
|
+
&& (mPagingEnabled
|
|
706
|
+
|| mSnapInterval != 0
|
|
707
|
+
|| mSnapOffsets != null
|
|
708
|
+
|| mSnapToAlignment != SNAP_ALIGNMENT_DISABLED)) {
|
|
709
|
+
// Cancel any pending post-touch runnable and reschedule
|
|
710
|
+
if (mPostTouchRunnable != null) {
|
|
711
|
+
removeCallbacks(mPostTouchRunnable);
|
|
712
|
+
}
|
|
713
|
+
mPostTouchRunnable =
|
|
714
|
+
new Runnable() {
|
|
715
|
+
@Override
|
|
716
|
+
public void run() {
|
|
717
|
+
mPostTouchRunnable = null;
|
|
718
|
+
// +1/-1 velocity if scrolling down or up. This is to ensure that the
|
|
719
|
+
// next/previous page is picked rather than sliding backwards to the current page
|
|
720
|
+
int velocityY = (int) -Math.signum(vScroll);
|
|
721
|
+
if (mDisableIntervalMomentum) {
|
|
722
|
+
velocityY = 0;
|
|
723
|
+
}
|
|
724
|
+
flingAndSnap(velocityY);
|
|
725
|
+
}
|
|
726
|
+
};
|
|
727
|
+
postOnAnimationDelayed(mPostTouchRunnable, ReactScrollViewHelper.MOMENTUM_DELAY);
|
|
728
|
+
}
|
|
729
|
+
return result;
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
return super.dispatchGenericMotionEvent(ev);
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
@Override
|
|
737
|
+
public boolean executeKeyEvent(KeyEvent event) {
|
|
738
|
+
int eventKeyCode = event.getKeyCode();
|
|
739
|
+
if (!mScrollEnabled
|
|
740
|
+
&& (eventKeyCode == KeyEvent.KEYCODE_DPAD_UP
|
|
741
|
+
|| eventKeyCode == KeyEvent.KEYCODE_DPAD_DOWN)) {
|
|
742
|
+
return false;
|
|
743
|
+
}
|
|
744
|
+
return super.executeKeyEvent(event);
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
@Override
|
|
748
|
+
public void setRemoveClippedSubviews(boolean removeClippedSubviews) {
|
|
749
|
+
if (ReactNativeFeatureFlags.disableSubviewClippingAndroid()) {
|
|
750
|
+
return;
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
if (removeClippedSubviews && mClippingRect == null) {
|
|
754
|
+
mClippingRect = new Rect();
|
|
755
|
+
}
|
|
756
|
+
mRemoveClippedSubviews = removeClippedSubviews;
|
|
757
|
+
updateClippingRect();
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
@Override
|
|
761
|
+
public boolean getRemoveClippedSubviews() {
|
|
762
|
+
return mRemoveClippedSubviews;
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
@Override
|
|
766
|
+
public void updateClippingRect() {
|
|
767
|
+
updateClippingRect(null);
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
@Override
|
|
771
|
+
public void updateClippingRect(@Nullable Set<Integer> excludedViewsSet) {
|
|
772
|
+
if (!mRemoveClippedSubviews) {
|
|
773
|
+
return;
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
Systrace.beginSection(Systrace.TRACE_TAG_REACT, "ReactNestedScrollView.updateClippingRect");
|
|
777
|
+
try {
|
|
778
|
+
Assertions.assertNotNull(mClippingRect);
|
|
779
|
+
|
|
780
|
+
ReactClippingViewGroupHelper.calculateClippingRect(this, mClippingRect);
|
|
781
|
+
View contentView = getContentView();
|
|
782
|
+
if (contentView instanceof ReactClippingViewGroup) {
|
|
783
|
+
((ReactClippingViewGroup) contentView).updateClippingRect(excludedViewsSet);
|
|
784
|
+
}
|
|
785
|
+
} finally {
|
|
786
|
+
Systrace.endSection(Systrace.TRACE_TAG_REACT);
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
@Override
|
|
791
|
+
public boolean getClipToPadding() {
|
|
792
|
+
if (ReactNativeFeatureFlags.syncAndroidClipToPaddingWithOverflow()) {
|
|
793
|
+
return mOverflow != Overflow.VISIBLE;
|
|
794
|
+
}
|
|
795
|
+
return super.getClipToPadding();
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
@Override
|
|
799
|
+
public void getClippingRect(Rect outClippingRect) {
|
|
800
|
+
outClippingRect.set(Assertions.assertNotNull(mClippingRect));
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
@Override
|
|
804
|
+
public boolean getChildVisibleRect(View child, Rect r, android.graphics.Point offset) {
|
|
805
|
+
return super.getChildVisibleRect(child, r, offset);
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
@Override
|
|
809
|
+
public void fling(int velocityY) {
|
|
810
|
+
final int correctedVelocityY = correctFlingVelocityY(velocityY);
|
|
811
|
+
|
|
812
|
+
if (mPagingEnabled) {
|
|
813
|
+
flingAndSnap(correctedVelocityY);
|
|
814
|
+
} else if (mScroller != null) {
|
|
815
|
+
// We provide our own version of fling that uses a different call to the standard OverScroller
|
|
816
|
+
// which takes into account the possibility of adding new content while the NestedScrollView is
|
|
817
|
+
// animating. Because we give essentially no max Y for the fling, the fling will continue as
|
|
818
|
+
// long
|
|
819
|
+
// as there is content. See #onOverScrolled() to see the second part of this change which
|
|
820
|
+
// properly
|
|
821
|
+
// aborts the scroller animation when we get to the bottom of the NestedScrollView content.
|
|
822
|
+
|
|
823
|
+
int scrollWindowHeight = getHeight() - getPaddingBottom() - getPaddingTop();
|
|
824
|
+
|
|
825
|
+
mScroller.fling(
|
|
826
|
+
getScrollX(), // startX
|
|
827
|
+
getScrollY(), // startY
|
|
828
|
+
0, // velocityX
|
|
829
|
+
correctedVelocityY, // velocityY
|
|
830
|
+
0, // minX
|
|
831
|
+
0, // maxX
|
|
832
|
+
0, // minY
|
|
833
|
+
Integer.MAX_VALUE, // maxY
|
|
834
|
+
0, // overX
|
|
835
|
+
scrollWindowHeight / 2 // overY
|
|
836
|
+
);
|
|
837
|
+
|
|
838
|
+
ViewCompat.postInvalidateOnAnimation(this);
|
|
839
|
+
} else {
|
|
840
|
+
super.fling(correctedVelocityY);
|
|
841
|
+
}
|
|
842
|
+
handlePostTouchScrolling(0, correctedVelocityY);
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
private int correctFlingVelocityY(int velocityY) {
|
|
846
|
+
if (Build.VERSION.SDK_INT != Build.VERSION_CODES.P) {
|
|
847
|
+
return velocityY;
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
// Workaround.
|
|
851
|
+
// On Android P if a NestedScrollView is inverted, we will get a wrong sign for
|
|
852
|
+
// velocityY (see https://issuetracker.google.com/issues/112385925).
|
|
853
|
+
// At the same time, mOnScrollDispatchHelper tracks the correct velocity direction.
|
|
854
|
+
//
|
|
855
|
+
// Hence, we can use the absolute value from whatever the OS gives
|
|
856
|
+
// us and use the sign of what mOnScrollDispatchHelper has tracked.
|
|
857
|
+
float signum = Math.signum(mOnScrollDispatchHelper.getYFlingVelocity());
|
|
858
|
+
if (signum == 0) {
|
|
859
|
+
signum = Math.signum(velocityY);
|
|
860
|
+
}
|
|
861
|
+
return (int) (Math.abs(velocityY) * signum);
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
private void enableFpsListener() {
|
|
865
|
+
if (isScrollPerfLoggingEnabled()) {
|
|
866
|
+
Assertions.assertNotNull(mFpsListener);
|
|
867
|
+
Assertions.assertNotNull(mScrollPerfTag);
|
|
868
|
+
mFpsListener.enable(mScrollPerfTag);
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
private void disableFpsListener() {
|
|
873
|
+
if (isScrollPerfLoggingEnabled()) {
|
|
874
|
+
Assertions.assertNotNull(mFpsListener);
|
|
875
|
+
Assertions.assertNotNull(mScrollPerfTag);
|
|
876
|
+
mFpsListener.disable(mScrollPerfTag);
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
private boolean isScrollPerfLoggingEnabled() {
|
|
881
|
+
return mFpsListener != null && mScrollPerfTag != null && !mScrollPerfTag.isEmpty();
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
private int getMaxScrollY() {
|
|
885
|
+
int contentHeight = mContentView == null ? 0 : mContentView.getHeight();
|
|
886
|
+
int viewportHeight = getHeight() - getPaddingBottom() - getPaddingTop();
|
|
887
|
+
return Math.max(0, contentHeight - viewportHeight);
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
@Nullable
|
|
891
|
+
public StateWrapper getStateWrapper() {
|
|
892
|
+
return mStateWrapper;
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
public void setStateWrapper(StateWrapper stateWrapper) {
|
|
896
|
+
mStateWrapper = stateWrapper;
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
@Override
|
|
900
|
+
public void draw(Canvas canvas) {
|
|
901
|
+
if (mEndFillColor != Color.TRANSPARENT) {
|
|
902
|
+
final View contentView = getContentView();
|
|
903
|
+
if (mEndBackground != null && contentView != null && contentView.getBottom() < getHeight()) {
|
|
904
|
+
mEndBackground.setBounds(0, contentView.getBottom(), getWidth(), getHeight());
|
|
905
|
+
mEndBackground.draw(canvas);
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
super.draw(canvas);
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
@Override
|
|
913
|
+
public void onDraw(Canvas canvas) {
|
|
914
|
+
if (mOverflow != Overflow.VISIBLE) {
|
|
915
|
+
BackgroundStyleApplicator.clipToPaddingBox(this, canvas);
|
|
916
|
+
}
|
|
917
|
+
super.onDraw(canvas);
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
/**
|
|
921
|
+
* This handles any sort of scrolling that may occur after a touch is finished. This may be
|
|
922
|
+
* momentum scrolling (fling) or because you have pagingEnabled on the scroll view. Because we
|
|
923
|
+
* don't get any events from Android about this lifecycle, we do all our detection by creating a
|
|
924
|
+
* runnable that checks if we scrolled in the last frame and if so assumes we are still scrolling.
|
|
925
|
+
*/
|
|
926
|
+
private void handlePostTouchScrolling(int velocityX, int velocityY) {
|
|
927
|
+
// Check if we are already handling this which may occur if this is called by both the touch up
|
|
928
|
+
// and a fling call
|
|
929
|
+
if (mPostTouchRunnable != null) {
|
|
930
|
+
return;
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
if (mSendMomentumEvents) {
|
|
934
|
+
enableFpsListener();
|
|
935
|
+
ReactScrollViewHelper.emitScrollMomentumBeginEvent(this, velocityX, velocityY);
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
mActivelyScrolling = false;
|
|
939
|
+
mPostTouchRunnable =
|
|
940
|
+
new Runnable() {
|
|
941
|
+
|
|
942
|
+
private boolean mSnappingToPage = false;
|
|
943
|
+
private int mStableFrames = 0;
|
|
944
|
+
|
|
945
|
+
@Override
|
|
946
|
+
public void run() {
|
|
947
|
+
if (mActivelyScrolling) {
|
|
948
|
+
// We are still scrolling.
|
|
949
|
+
mActivelyScrolling = false;
|
|
950
|
+
mStableFrames = 0;
|
|
951
|
+
ReactNestedScrollView.this.postOnAnimationDelayed(
|
|
952
|
+
this, ReactScrollViewHelper.MOMENTUM_DELAY);
|
|
953
|
+
} else {
|
|
954
|
+
// There has not been a scroll update since the last time this Runnable executed.
|
|
955
|
+
ReactScrollViewHelper.updateFabricScrollState(ReactNestedScrollView.this);
|
|
956
|
+
|
|
957
|
+
// We keep checking for updates until the NestedScrollView has "stabilized" and hasn't
|
|
958
|
+
// scrolled for N consecutive frames. This number is arbitrary: big enough to catch
|
|
959
|
+
// a number of race conditions, but small enough to not cause perf regressions, etc.
|
|
960
|
+
// In anecdotal testing, it seemed like a decent number.
|
|
961
|
+
// Without this check, sometimes this Runnable stops executing too soon - it will
|
|
962
|
+
// fire before the first scroll event of an animated scroll/fling, and stop
|
|
963
|
+
// immediately.
|
|
964
|
+
mStableFrames++;
|
|
965
|
+
|
|
966
|
+
if (mStableFrames >= 3) {
|
|
967
|
+
mPostTouchRunnable = null;
|
|
968
|
+
if (mSendMomentumEvents) {
|
|
969
|
+
ReactScrollViewHelper.emitScrollMomentumEndEvent(ReactNestedScrollView.this);
|
|
970
|
+
}
|
|
971
|
+
ReactScrollViewHelper.notifyUserDrivenScrollEnded_internal(ReactNestedScrollView.this);
|
|
972
|
+
disableFpsListener();
|
|
973
|
+
} else {
|
|
974
|
+
if (mPagingEnabled && !mSnappingToPage) {
|
|
975
|
+
// If we have pagingEnabled and we have not snapped to the page
|
|
976
|
+
// we need to cause that scroll by asking for it
|
|
977
|
+
mSnappingToPage = true;
|
|
978
|
+
flingAndSnap(0);
|
|
979
|
+
}
|
|
980
|
+
// The scrollview has not "stabilized" so we just post to check again a frame later
|
|
981
|
+
ReactNestedScrollView.this.postOnAnimationDelayed(
|
|
982
|
+
this, ReactScrollViewHelper.MOMENTUM_DELAY);
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
};
|
|
987
|
+
postOnAnimationDelayed(mPostTouchRunnable, ReactScrollViewHelper.MOMENTUM_DELAY);
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
private void cancelPostTouchScrolling() {
|
|
991
|
+
if (mPostTouchRunnable != null) {
|
|
992
|
+
removeCallbacks(mPostTouchRunnable);
|
|
993
|
+
mPostTouchRunnable = null;
|
|
994
|
+
getFlingAnimator().cancel();
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
private int predictFinalScrollPosition(int velocityY) {
|
|
999
|
+
// predict where a fling would end up so we can scroll to the nearest snap offset
|
|
1000
|
+
// TODO(T106335409): Existing prediction still uses overscroller. Consider change this to use
|
|
1001
|
+
// fling animator instead.
|
|
1002
|
+
return getFlingAnimator() == DEFAULT_FLING_ANIMATOR
|
|
1003
|
+
? ReactScrollViewHelper.predictFinalScrollPosition(this, 0, velocityY, 0, getMaxScrollY()).y
|
|
1004
|
+
: ReactScrollViewHelper.getNextFlingStartValue(
|
|
1005
|
+
this,
|
|
1006
|
+
getScrollY(),
|
|
1007
|
+
getReactScrollViewScrollState().getFinalAnimatedPositionScroll().y,
|
|
1008
|
+
velocityY)
|
|
1009
|
+
+ getFlingExtrapolatedDistance(velocityY);
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
private View getContentView() {
|
|
1013
|
+
return getChildAt(0);
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
/**
|
|
1017
|
+
* This will smooth scroll us to the nearest snap offset point It currently just looks at where
|
|
1018
|
+
* the content is and slides to the nearest point. It is intended to be run after we are done
|
|
1019
|
+
* scrolling, and handling any momentum scrolling.
|
|
1020
|
+
*/
|
|
1021
|
+
private void smoothScrollAndSnap(int velocity) {
|
|
1022
|
+
double interval = (double) getSnapInterval();
|
|
1023
|
+
double currentOffset =
|
|
1024
|
+
(double)
|
|
1025
|
+
(ReactScrollViewHelper.getNextFlingStartValue(
|
|
1026
|
+
this,
|
|
1027
|
+
getScrollY(),
|
|
1028
|
+
getReactScrollViewScrollState().getFinalAnimatedPositionScroll().y,
|
|
1029
|
+
velocity));
|
|
1030
|
+
double targetOffset = (double) predictFinalScrollPosition(velocity);
|
|
1031
|
+
|
|
1032
|
+
int previousPage = (int) Math.floor(currentOffset / interval);
|
|
1033
|
+
int nextPage = (int) Math.ceil(currentOffset / interval);
|
|
1034
|
+
int currentPage = (int) Math.round(currentOffset / interval);
|
|
1035
|
+
int targetPage = (int) Math.round(targetOffset / interval);
|
|
1036
|
+
|
|
1037
|
+
if (velocity > 0 && nextPage == previousPage) {
|
|
1038
|
+
nextPage++;
|
|
1039
|
+
} else if (velocity < 0 && previousPage == nextPage) {
|
|
1040
|
+
previousPage--;
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
if (
|
|
1044
|
+
// if scrolling towards next page
|
|
1045
|
+
velocity > 0
|
|
1046
|
+
&&
|
|
1047
|
+
// and the middle of the page hasn't been crossed already
|
|
1048
|
+
currentPage < nextPage
|
|
1049
|
+
&&
|
|
1050
|
+
// and it would have been crossed after flinging
|
|
1051
|
+
targetPage > previousPage) {
|
|
1052
|
+
currentPage = nextPage;
|
|
1053
|
+
} else if (
|
|
1054
|
+
// if scrolling towards previous page
|
|
1055
|
+
velocity < 0
|
|
1056
|
+
&&
|
|
1057
|
+
// and the middle of the page hasn't been crossed already
|
|
1058
|
+
currentPage > previousPage
|
|
1059
|
+
&&
|
|
1060
|
+
// and it would have been crossed after flinging
|
|
1061
|
+
targetPage < nextPage) {
|
|
1062
|
+
currentPage = previousPage;
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
targetOffset = currentPage * interval;
|
|
1066
|
+
if (targetOffset != currentOffset) {
|
|
1067
|
+
mActivelyScrolling = true;
|
|
1068
|
+
reactSmoothScrollTo(getScrollX(), (int) targetOffset);
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
private void flingAndSnap(int velocityY) {
|
|
1073
|
+
if (getChildCount() <= 0) {
|
|
1074
|
+
return;
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
// pagingEnabled only allows snapping one interval at a time
|
|
1078
|
+
if (mSnapInterval == 0 && mSnapOffsets == null && mSnapToAlignment == SNAP_ALIGNMENT_DISABLED) {
|
|
1079
|
+
smoothScrollAndSnap(velocityY);
|
|
1080
|
+
return;
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
boolean hasCustomizedFlingAnimator = getFlingAnimator() != DEFAULT_FLING_ANIMATOR;
|
|
1084
|
+
int maximumOffset = getMaxScrollY();
|
|
1085
|
+
int targetOffset = predictFinalScrollPosition(velocityY);
|
|
1086
|
+
if (mDisableIntervalMomentum) {
|
|
1087
|
+
targetOffset = getScrollY();
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
int smallerOffset = 0;
|
|
1091
|
+
int largerOffset = maximumOffset;
|
|
1092
|
+
int firstOffset = 0;
|
|
1093
|
+
int lastOffset = maximumOffset;
|
|
1094
|
+
int height = getHeight() - getPaddingBottom() - getPaddingTop();
|
|
1095
|
+
|
|
1096
|
+
// get the nearest snap points to the target offset
|
|
1097
|
+
if (mSnapOffsets != null) {
|
|
1098
|
+
firstOffset = mSnapOffsets.get(0);
|
|
1099
|
+
lastOffset = mSnapOffsets.get(mSnapOffsets.size() - 1);
|
|
1100
|
+
|
|
1101
|
+
for (int i = 0; i < mSnapOffsets.size(); i++) {
|
|
1102
|
+
int offset = mSnapOffsets.get(i);
|
|
1103
|
+
|
|
1104
|
+
if (offset <= targetOffset) {
|
|
1105
|
+
if (targetOffset - offset < targetOffset - smallerOffset) {
|
|
1106
|
+
smallerOffset = offset;
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
if (offset >= targetOffset) {
|
|
1111
|
+
if (offset - targetOffset < largerOffset - targetOffset) {
|
|
1112
|
+
largerOffset = offset;
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
} else if (mSnapToAlignment != SNAP_ALIGNMENT_DISABLED) {
|
|
1118
|
+
if (mSnapInterval > 0) {
|
|
1119
|
+
double ratio = (double) targetOffset / mSnapInterval;
|
|
1120
|
+
smallerOffset =
|
|
1121
|
+
Math.max(
|
|
1122
|
+
getItemStartOffset(
|
|
1123
|
+
mSnapToAlignment,
|
|
1124
|
+
(int) (Math.floor(ratio) * mSnapInterval),
|
|
1125
|
+
mSnapInterval,
|
|
1126
|
+
height),
|
|
1127
|
+
0);
|
|
1128
|
+
largerOffset =
|
|
1129
|
+
Math.min(
|
|
1130
|
+
getItemStartOffset(
|
|
1131
|
+
mSnapToAlignment,
|
|
1132
|
+
(int) (Math.ceil(ratio) * mSnapInterval),
|
|
1133
|
+
mSnapInterval,
|
|
1134
|
+
height),
|
|
1135
|
+
maximumOffset);
|
|
1136
|
+
} else {
|
|
1137
|
+
ViewGroup contentView = (ViewGroup) getContentView();
|
|
1138
|
+
int smallerChildOffset = largerOffset;
|
|
1139
|
+
int largerChildOffset = smallerOffset;
|
|
1140
|
+
for (int i = 0; i < contentView.getChildCount(); i++) {
|
|
1141
|
+
View item = contentView.getChildAt(i);
|
|
1142
|
+
int itemStartOffset;
|
|
1143
|
+
switch (mSnapToAlignment) {
|
|
1144
|
+
case SNAP_ALIGNMENT_CENTER:
|
|
1145
|
+
itemStartOffset = item.getTop() - (height - item.getHeight()) / 2;
|
|
1146
|
+
break;
|
|
1147
|
+
case SNAP_ALIGNMENT_START:
|
|
1148
|
+
itemStartOffset = item.getTop();
|
|
1149
|
+
break;
|
|
1150
|
+
case SNAP_ALIGNMENT_END:
|
|
1151
|
+
itemStartOffset = item.getTop() - (height - item.getHeight());
|
|
1152
|
+
break;
|
|
1153
|
+
default:
|
|
1154
|
+
throw new IllegalStateException("Invalid SnapToAlignment value: " + mSnapToAlignment);
|
|
1155
|
+
}
|
|
1156
|
+
if (itemStartOffset <= targetOffset) {
|
|
1157
|
+
if (targetOffset - itemStartOffset < targetOffset - smallerOffset) {
|
|
1158
|
+
smallerOffset = itemStartOffset;
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
if (itemStartOffset >= targetOffset) {
|
|
1163
|
+
if (itemStartOffset - targetOffset < largerOffset - targetOffset) {
|
|
1164
|
+
largerOffset = itemStartOffset;
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
smallerChildOffset = Math.min(smallerChildOffset, itemStartOffset);
|
|
1169
|
+
largerChildOffset = Math.max(largerChildOffset, itemStartOffset);
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
// For Recycler ViewGroup, the maximumOffset can be much larger than the total heights of
|
|
1173
|
+
// items in the layout. In this case snapping is not possible beyond the currently rendered
|
|
1174
|
+
// children.
|
|
1175
|
+
smallerOffset = Math.max(smallerOffset, smallerChildOffset);
|
|
1176
|
+
largerOffset = Math.min(largerOffset, largerChildOffset);
|
|
1177
|
+
}
|
|
1178
|
+
} else {
|
|
1179
|
+
double interval = (double) getSnapInterval();
|
|
1180
|
+
double ratio = (double) targetOffset / interval;
|
|
1181
|
+
smallerOffset = (int) (Math.floor(ratio) * interval);
|
|
1182
|
+
largerOffset = Math.min((int) (Math.ceil(ratio) * interval), maximumOffset);
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
// Calculate the nearest offset
|
|
1186
|
+
int nearestOffset =
|
|
1187
|
+
Math.abs(targetOffset - smallerOffset) < Math.abs(largerOffset - targetOffset)
|
|
1188
|
+
? smallerOffset
|
|
1189
|
+
: largerOffset;
|
|
1190
|
+
|
|
1191
|
+
// if scrolling after the last snap offset and snapping to the
|
|
1192
|
+
// end of the list is disabled, then we allow free scrolling
|
|
1193
|
+
if (!mSnapToEnd && targetOffset >= lastOffset) {
|
|
1194
|
+
if (getScrollY() >= lastOffset) {
|
|
1195
|
+
// free scrolling
|
|
1196
|
+
} else {
|
|
1197
|
+
// snap to end
|
|
1198
|
+
targetOffset = lastOffset;
|
|
1199
|
+
}
|
|
1200
|
+
} else if (!mSnapToStart && targetOffset <= firstOffset) {
|
|
1201
|
+
if (getScrollY() <= firstOffset) {
|
|
1202
|
+
// free scrolling
|
|
1203
|
+
} else {
|
|
1204
|
+
// snap to beginning
|
|
1205
|
+
targetOffset = firstOffset;
|
|
1206
|
+
}
|
|
1207
|
+
} else if (velocityY > 0) {
|
|
1208
|
+
if (!hasCustomizedFlingAnimator) {
|
|
1209
|
+
// The default animator requires boost on initial velocity as when snapping velocity can
|
|
1210
|
+
// feel sluggish for slow swipes
|
|
1211
|
+
velocityY += (int) ((largerOffset - targetOffset) * 10.0);
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
targetOffset = largerOffset;
|
|
1215
|
+
} else if (velocityY < 0) {
|
|
1216
|
+
if (!hasCustomizedFlingAnimator) {
|
|
1217
|
+
// The default animator requires boost on initial velocity as when snapping velocity can
|
|
1218
|
+
// feel sluggish for slow swipes
|
|
1219
|
+
velocityY -= (int) ((targetOffset - smallerOffset) * 10.0);
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
targetOffset = smallerOffset;
|
|
1223
|
+
} else {
|
|
1224
|
+
targetOffset = nearestOffset;
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
// Make sure the new offset isn't out of bounds
|
|
1228
|
+
targetOffset = Math.min(Math.max(0, targetOffset), maximumOffset);
|
|
1229
|
+
|
|
1230
|
+
if (hasCustomizedFlingAnimator || mScroller == null) {
|
|
1231
|
+
reactSmoothScrollTo(getScrollX(), targetOffset);
|
|
1232
|
+
} else {
|
|
1233
|
+
// smoothScrollTo will always scroll over 250ms which is often *waaay*
|
|
1234
|
+
// too short and will cause the scrolling to feel almost instant
|
|
1235
|
+
// try to manually interact with OverScroller instead
|
|
1236
|
+
// if velocity is 0 however, fling() won't work, so we want to use smoothScrollTo
|
|
1237
|
+
mActivelyScrolling = true;
|
|
1238
|
+
|
|
1239
|
+
mScroller.fling(
|
|
1240
|
+
getScrollX(), // startX
|
|
1241
|
+
getScrollY(), // startY
|
|
1242
|
+
// velocity = 0 doesn't work with fling() so we pretend there's a reasonable
|
|
1243
|
+
// initial velocity going on when a touch is released without any movement
|
|
1244
|
+
0, // velocityX
|
|
1245
|
+
velocityY != 0 ? velocityY : targetOffset - getScrollY(), // velocityY
|
|
1246
|
+
0, // minX
|
|
1247
|
+
0, // maxX
|
|
1248
|
+
// setting both minY and maxY to the same value will guarantee that we scroll to it
|
|
1249
|
+
// but using the standard fling-style easing rather than smoothScrollTo's 250ms animation
|
|
1250
|
+
targetOffset, // minY
|
|
1251
|
+
targetOffset, // maxY
|
|
1252
|
+
0, // overX
|
|
1253
|
+
// we only want to allow overscrolling if the final offset is at the very edge of the view
|
|
1254
|
+
(targetOffset == 0 || targetOffset == maximumOffset) ? height / 2 : 0 // overY
|
|
1255
|
+
);
|
|
1256
|
+
|
|
1257
|
+
postInvalidateOnAnimation();
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
private int getItemStartOffset(
|
|
1262
|
+
int snapToAlignment, int itemStartPosition, int itemHeight, int viewPortHeight) {
|
|
1263
|
+
int itemStartOffset;
|
|
1264
|
+
switch (snapToAlignment) {
|
|
1265
|
+
case SNAP_ALIGNMENT_CENTER:
|
|
1266
|
+
itemStartOffset = itemStartPosition - (viewPortHeight - itemHeight) / 2;
|
|
1267
|
+
break;
|
|
1268
|
+
case SNAP_ALIGNMENT_START:
|
|
1269
|
+
itemStartOffset = itemStartPosition;
|
|
1270
|
+
break;
|
|
1271
|
+
case SNAP_ALIGNMENT_END:
|
|
1272
|
+
itemStartOffset = itemStartPosition - (viewPortHeight - itemHeight);
|
|
1273
|
+
break;
|
|
1274
|
+
default:
|
|
1275
|
+
throw new IllegalStateException("Invalid SnapToAlignment value: " + mSnapToAlignment);
|
|
1276
|
+
}
|
|
1277
|
+
return itemStartOffset;
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
private int getSnapInterval() {
|
|
1281
|
+
if (mSnapInterval != 0) {
|
|
1282
|
+
return mSnapInterval;
|
|
1283
|
+
}
|
|
1284
|
+
return getHeight();
|
|
1285
|
+
}
|
|
1286
|
+
|
|
1287
|
+
public void setEndFillColor(int color) {
|
|
1288
|
+
if (color != mEndFillColor) {
|
|
1289
|
+
mEndFillColor = color;
|
|
1290
|
+
mEndBackground = new ColorDrawable(mEndFillColor);
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
@Override
|
|
1295
|
+
protected void onOverScrolled(int scrollX, int scrollY, boolean clampedX, boolean clampedY) {
|
|
1296
|
+
if (mScroller != null && mContentView != null) {
|
|
1297
|
+
// This is part two of the reimplementation of fling to fix the bounce-back bug. See #fling()
|
|
1298
|
+
// for more information.
|
|
1299
|
+
|
|
1300
|
+
if (!mScroller.isFinished() && mScroller.getCurrY() != mScroller.getFinalY()) {
|
|
1301
|
+
int scrollRange = getMaxScrollY();
|
|
1302
|
+
if (scrollY >= scrollRange) {
|
|
1303
|
+
mScroller.abortAnimation();
|
|
1304
|
+
scrollY = scrollRange;
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
if (ReactNativeFeatureFlags.shouldTriggerResponderTransferOnScrollAndroid()
|
|
1310
|
+
&& clampedY
|
|
1311
|
+
&& mEmittedOverScrollSinceScrollBegin == false) {
|
|
1312
|
+
ReactScrollViewHelper.emitScrollEvent(this, 0f, 0f);
|
|
1313
|
+
mEmittedOverScrollSinceScrollBegin = true;
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1316
|
+
super.onOverScrolled(scrollX, scrollY, clampedX, clampedY);
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
@Override
|
|
1320
|
+
public void onChildViewAdded(View parent, View child) {
|
|
1321
|
+
mContentView = child;
|
|
1322
|
+
mContentView.addOnLayoutChangeListener(this);
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
@Override
|
|
1326
|
+
public void onChildViewRemoved(View parent, View child) {
|
|
1327
|
+
if (mContentView != null) {
|
|
1328
|
+
mContentView.removeOnLayoutChangeListener(this);
|
|
1329
|
+
mContentView = null;
|
|
1330
|
+
}
|
|
1331
|
+
}
|
|
1332
|
+
|
|
1333
|
+
public void setContentOffset(@Nullable ReadableMap value) {
|
|
1334
|
+
// When contentOffset={{x:0,y:0}} with lazy load items, setContentOffset
|
|
1335
|
+
// is repeatedly called, causing an unexpected scroll to top behavior.
|
|
1336
|
+
// Avoid updating contentOffset if the value has not changed.
|
|
1337
|
+
if (mCurrentContentOffset == null || !mCurrentContentOffset.equals(value)) {
|
|
1338
|
+
mCurrentContentOffset = value;
|
|
1339
|
+
|
|
1340
|
+
if (value != null) {
|
|
1341
|
+
double x = value.hasKey("x") ? value.getDouble("x") : 0;
|
|
1342
|
+
double y = value.hasKey("y") ? value.getDouble("y") : 0;
|
|
1343
|
+
scrollTo((int) PixelUtil.toPixelFromDIP(x), (int) PixelUtil.toPixelFromDIP(y));
|
|
1344
|
+
} else {
|
|
1345
|
+
scrollTo(0, 0);
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
|
|
1350
|
+
/**
|
|
1351
|
+
* Calls `smoothScrollTo` and updates state.
|
|
1352
|
+
*
|
|
1353
|
+
* <p>`smoothScrollTo` changes `contentOffset` and we need to keep `contentOffset` in sync between
|
|
1354
|
+
* scroll view and state. Calling raw `smoothScrollTo` doesn't update state.
|
|
1355
|
+
*/
|
|
1356
|
+
public void reactSmoothScrollTo(int x, int y) {
|
|
1357
|
+
ReactScrollViewHelper.smoothScrollTo(this, x, y);
|
|
1358
|
+
setPendingContentOffsets(x, y);
|
|
1359
|
+
}
|
|
1360
|
+
|
|
1361
|
+
/**
|
|
1362
|
+
* Calls `super.scrollTo` and updates state.
|
|
1363
|
+
*
|
|
1364
|
+
* <p>`super.scrollTo` changes `contentOffset` and we need to keep `contentOffset` in sync between
|
|
1365
|
+
* scroll view and state.
|
|
1366
|
+
*
|
|
1367
|
+
* <p>Note that while we can override scrollTo, we *cannot* override `smoothScrollTo` because it
|
|
1368
|
+
* is final. See `reactSmoothScrollTo`.
|
|
1369
|
+
*/
|
|
1370
|
+
@Override
|
|
1371
|
+
public void scrollTo(int x, int y) {
|
|
1372
|
+
super.scrollTo(x, y);
|
|
1373
|
+
ReactScrollViewHelper.updateFabricScrollState(this);
|
|
1374
|
+
setPendingContentOffsets(x, y);
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1377
|
+
/**
|
|
1378
|
+
* If we are in the middle of a fling animation from the user removing their finger (OverScroller
|
|
1379
|
+
* is in `FLING_MODE`), recreate the existing fling animation since it was calculated against
|
|
1380
|
+
* outdated scroll offsets.
|
|
1381
|
+
*/
|
|
1382
|
+
private void recreateFlingAnimation(int scrollY) {
|
|
1383
|
+
// If we have any pending custom flings (e.g. from animated `scrollTo`, or flinging to a snap
|
|
1384
|
+
// point), cancel them.
|
|
1385
|
+
// TODO: Can we be more graceful (like OverScroller flings)?
|
|
1386
|
+
if (getFlingAnimator().isRunning()) {
|
|
1387
|
+
getFlingAnimator().cancel();
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
if (mScroller != null && !mScroller.isFinished()) {
|
|
1391
|
+
// Calculate the velocity and position of the fling animation at the time of this layout
|
|
1392
|
+
// event, which may be later than the last NestedScrollView tick. These values are not committed to
|
|
1393
|
+
// the underlying NestedScrollView, which will recalculate positions on its next tick.
|
|
1394
|
+
int scrollerYBeforeTick = mScroller.getCurrY();
|
|
1395
|
+
boolean hasMoreTicks = mScroller.computeScrollOffset();
|
|
1396
|
+
|
|
1397
|
+
// Stop the existing animation at the current state of the scroller. We will then recreate
|
|
1398
|
+
// it starting at the adjusted y offset.
|
|
1399
|
+
mScroller.forceFinished(true);
|
|
1400
|
+
|
|
1401
|
+
if (hasMoreTicks) {
|
|
1402
|
+
// OverScroller.getCurrVelocity() returns an absolute value of the velocity a current fling
|
|
1403
|
+
// animation (only FLING_MODE animations). We derive direction along the Y axis from the
|
|
1404
|
+
// start and end of the, animation assuming NestedScrollView never fires horizontal fling
|
|
1405
|
+
// animations.
|
|
1406
|
+
// TODO: This does not fully handle overscroll.
|
|
1407
|
+
float direction = Math.signum(mScroller.getFinalY() - mScroller.getStartY());
|
|
1408
|
+
float flingVelocityY = mScroller.getCurrVelocity() * direction;
|
|
1409
|
+
|
|
1410
|
+
mScroller.fling(getScrollX(), scrollY, 0, (int) flingVelocityY, 0, 0, 0, Integer.MAX_VALUE);
|
|
1411
|
+
} else {
|
|
1412
|
+
scrollTo(getScrollX(), scrollY + (mScroller.getCurrY() - scrollerYBeforeTick));
|
|
1413
|
+
}
|
|
1414
|
+
}
|
|
1415
|
+
}
|
|
1416
|
+
|
|
1417
|
+
/** Scrolls to a new position preserving any momentum scrolling animation. */
|
|
1418
|
+
@Override
|
|
1419
|
+
public void scrollToPreservingMomentum(int x, int y) {
|
|
1420
|
+
scrollTo(x, y);
|
|
1421
|
+
recreateFlingAnimation(y);
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1424
|
+
private boolean isContentReady() {
|
|
1425
|
+
View child = getContentView();
|
|
1426
|
+
return child != null && child.getWidth() != 0 && child.getHeight() != 0;
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
/**
|
|
1430
|
+
* If contentOffset is set before the View has been laid out, store the values and set them when
|
|
1431
|
+
* `onLayout` is called.
|
|
1432
|
+
*
|
|
1433
|
+
* @param x
|
|
1434
|
+
* @param y
|
|
1435
|
+
*/
|
|
1436
|
+
private void setPendingContentOffsets(int x, int y) {
|
|
1437
|
+
if (isContentReady()) {
|
|
1438
|
+
mPendingContentOffsetX = UNSET_CONTENT_OFFSET;
|
|
1439
|
+
mPendingContentOffsetY = UNSET_CONTENT_OFFSET;
|
|
1440
|
+
} else {
|
|
1441
|
+
mPendingContentOffsetX = x;
|
|
1442
|
+
mPendingContentOffsetY = y;
|
|
1443
|
+
}
|
|
1444
|
+
}
|
|
1445
|
+
|
|
1446
|
+
/**
|
|
1447
|
+
* Called when a mContentView's layout has changed. Fixes the scroll position if it's too large
|
|
1448
|
+
* after the content resizes. Without this, the user would see a blank NestedScrollView when the scroll
|
|
1449
|
+
* position is larger than the NestedScrollView's max scroll position after the content shrinks.
|
|
1450
|
+
*/
|
|
1451
|
+
@Override
|
|
1452
|
+
public void onLayoutChange(
|
|
1453
|
+
View v,
|
|
1454
|
+
int left,
|
|
1455
|
+
int top,
|
|
1456
|
+
int right,
|
|
1457
|
+
int bottom,
|
|
1458
|
+
int oldLeft,
|
|
1459
|
+
int oldTop,
|
|
1460
|
+
int oldRight,
|
|
1461
|
+
int oldBottom) {
|
|
1462
|
+
if (mContentView == null) {
|
|
1463
|
+
return;
|
|
1464
|
+
}
|
|
1465
|
+
|
|
1466
|
+
if (mMaintainVisibleContentPositionHelper != null) {
|
|
1467
|
+
mMaintainVisibleContentPositionHelper.updateScrollPosition();
|
|
1468
|
+
}
|
|
1469
|
+
|
|
1470
|
+
if (isShown() && isContentReady()) {
|
|
1471
|
+
int currentScrollY = getScrollY();
|
|
1472
|
+
int maxScrollY = getMaxScrollY();
|
|
1473
|
+
if (currentScrollY > maxScrollY) {
|
|
1474
|
+
scrollTo(getScrollX(), maxScrollY);
|
|
1475
|
+
}
|
|
1476
|
+
}
|
|
1477
|
+
|
|
1478
|
+
ReactScrollViewHelper.emitLayoutChangeEvent(this);
|
|
1479
|
+
}
|
|
1480
|
+
|
|
1481
|
+
@Override
|
|
1482
|
+
public void setBackgroundColor(int color) {
|
|
1483
|
+
BackgroundStyleApplicator.setBackgroundColor(this, color);
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1486
|
+
public void setBorderWidth(int position, float width) {
|
|
1487
|
+
BackgroundStyleApplicator.setBorderWidth(
|
|
1488
|
+
this, LogicalEdge.values()[position], PixelUtil.toDIPFromPixel(width));
|
|
1489
|
+
}
|
|
1490
|
+
|
|
1491
|
+
public void setBorderColor(int position, @Nullable Integer color) {
|
|
1492
|
+
BackgroundStyleApplicator.setBorderColor(this, LogicalEdge.values()[position], color);
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
public void setBorderRadius(float borderRadius) {
|
|
1496
|
+
setBorderRadius(borderRadius, BorderRadiusProp.BORDER_RADIUS.ordinal());
|
|
1497
|
+
}
|
|
1498
|
+
|
|
1499
|
+
public void setBorderRadius(float borderRadius, int position) {
|
|
1500
|
+
@Nullable
|
|
1501
|
+
LengthPercentage radius =
|
|
1502
|
+
Float.isNaN(borderRadius)
|
|
1503
|
+
? null
|
|
1504
|
+
: new LengthPercentage(
|
|
1505
|
+
PixelUtil.toDIPFromPixel(borderRadius), LengthPercentageType.POINT);
|
|
1506
|
+
BackgroundStyleApplicator.setBorderRadius(this, BorderRadiusProp.values()[position], radius);
|
|
1507
|
+
}
|
|
1508
|
+
|
|
1509
|
+
public void setBorderStyle(@Nullable String style) {
|
|
1510
|
+
BackgroundStyleApplicator.setBorderStyle(
|
|
1511
|
+
this, style == null ? null : BorderStyle.fromString(style));
|
|
1512
|
+
}
|
|
1513
|
+
|
|
1514
|
+
/**
|
|
1515
|
+
* ScrollAway: This enables a natively-controlled navbar that optionally obscures the top content
|
|
1516
|
+
* of the NestedScrollView. Whether or not the navbar is obscuring the React Native surface is
|
|
1517
|
+
* determined outside of React Native.
|
|
1518
|
+
*
|
|
1519
|
+
* <p>Note: all NestedScrollViews and HorizontalScrollViews in React have exactly one child: the
|
|
1520
|
+
* "content" View (see NestedScrollView.js). That View is non-collapsable so it will never be
|
|
1521
|
+
* View-flattened away. However, it is possible to pass custom styles into that View.
|
|
1522
|
+
*
|
|
1523
|
+
* <p>If you are using this feature it is assumed that you have full control over this NestedScrollView
|
|
1524
|
+
* and that you are **not** overriding the NestedScrollView content view to pass in a `translateY`
|
|
1525
|
+
* style. `translateY` must never be set from ReactJS while using this feature!
|
|
1526
|
+
*/
|
|
1527
|
+
public void setScrollAwayTopPaddingEnabledUnstable(int topPadding) {
|
|
1528
|
+
setScrollAwayTopPaddingEnabledUnstable(topPadding, true);
|
|
1529
|
+
}
|
|
1530
|
+
|
|
1531
|
+
public void setScrollAwayTopPaddingEnabledUnstable(int topPadding, boolean updateState) {
|
|
1532
|
+
int count = getChildCount();
|
|
1533
|
+
|
|
1534
|
+
Assertions.assertCondition(
|
|
1535
|
+
count <= 1,
|
|
1536
|
+
"React Native NestedScrollView should not have more than one child, it should have exactly 1"
|
|
1537
|
+
+ " child; a content View");
|
|
1538
|
+
|
|
1539
|
+
if (count > 0) {
|
|
1540
|
+
for (int i = 0; i < count; i++) {
|
|
1541
|
+
View childView = getChildAt(i);
|
|
1542
|
+
childView.setTranslationY(topPadding);
|
|
1543
|
+
}
|
|
1544
|
+
|
|
1545
|
+
// Add the topPadding value as the bottom padding for the NestedScrollView.
|
|
1546
|
+
// Otherwise, we'll push down the contents of the scroll view down too
|
|
1547
|
+
// far off screen.
|
|
1548
|
+
setPadding(0, 0, 0, topPadding);
|
|
1549
|
+
}
|
|
1550
|
+
|
|
1551
|
+
if (updateState) {
|
|
1552
|
+
updateScrollAwayState(topPadding);
|
|
1553
|
+
}
|
|
1554
|
+
setRemoveClippedSubviews(mRemoveClippedSubviews);
|
|
1555
|
+
}
|
|
1556
|
+
|
|
1557
|
+
private void updateScrollAwayState(int scrollAwayPaddingTop) {
|
|
1558
|
+
getReactScrollViewScrollState().setScrollAwayPaddingTop(scrollAwayPaddingTop);
|
|
1559
|
+
ReactScrollViewHelper.forceUpdateState(this);
|
|
1560
|
+
}
|
|
1561
|
+
|
|
1562
|
+
@Override
|
|
1563
|
+
public void setReactScrollViewScrollState(ReactScrollViewScrollState scrollState) {
|
|
1564
|
+
mReactScrollViewScrollState = scrollState;
|
|
1565
|
+
if (ReactNativeFeatureFlags.enableViewCulling()
|
|
1566
|
+
|| ReactNativeFeatureFlags.useTraitHiddenOnAndroid()) {
|
|
1567
|
+
setScrollAwayTopPaddingEnabledUnstable(scrollState.getScrollAwayPaddingTop(), false);
|
|
1568
|
+
|
|
1569
|
+
Point scrollPosition = scrollState.getLastStateUpdateScroll();
|
|
1570
|
+
scrollTo(scrollPosition.x, scrollPosition.y);
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
|
|
1574
|
+
@Override
|
|
1575
|
+
public ReactScrollViewScrollState getReactScrollViewScrollState() {
|
|
1576
|
+
return mReactScrollViewScrollState;
|
|
1577
|
+
}
|
|
1578
|
+
|
|
1579
|
+
@Override
|
|
1580
|
+
public void startFlingAnimator(int start, int end) {
|
|
1581
|
+
// Always cancel existing animator before starting the new one. `smoothScrollTo` contains some
|
|
1582
|
+
// logic that, if called multiple times in a short amount of time, will treat all calls as part
|
|
1583
|
+
// of the same animation and will not lengthen the duration of the animation. This means that,
|
|
1584
|
+
// for example, if the user is scrolling rapidly, multiple pages could be considered part of one
|
|
1585
|
+
// animation, causing some page animations to be animated very rapidly - looking like they're
|
|
1586
|
+
// not animated at all.
|
|
1587
|
+
DEFAULT_FLING_ANIMATOR.cancel();
|
|
1588
|
+
|
|
1589
|
+
// Update the fling animator with new values
|
|
1590
|
+
int duration = ReactScrollViewHelper.getDefaultScrollAnimationDuration(getContext());
|
|
1591
|
+
DEFAULT_FLING_ANIMATOR.setDuration(duration).setIntValues(start, end);
|
|
1592
|
+
|
|
1593
|
+
// Start the animator
|
|
1594
|
+
DEFAULT_FLING_ANIMATOR.start();
|
|
1595
|
+
|
|
1596
|
+
if (mSendMomentumEvents) {
|
|
1597
|
+
int yVelocity = 0;
|
|
1598
|
+
if (duration > 0) {
|
|
1599
|
+
yVelocity = (end - start) / duration;
|
|
1600
|
+
}
|
|
1601
|
+
ReactScrollViewHelper.emitScrollMomentumBeginEvent(this, 0, yVelocity);
|
|
1602
|
+
ReactScrollViewHelper.dispatchMomentumEndOnAnimationEnd(this);
|
|
1603
|
+
}
|
|
1604
|
+
}
|
|
1605
|
+
|
|
1606
|
+
@NonNull
|
|
1607
|
+
@Override
|
|
1608
|
+
public ValueAnimator getFlingAnimator() {
|
|
1609
|
+
return DEFAULT_FLING_ANIMATOR;
|
|
1610
|
+
}
|
|
1611
|
+
|
|
1612
|
+
@Override
|
|
1613
|
+
public int getFlingExtrapolatedDistance(int velocityY) {
|
|
1614
|
+
// The DEFAULT_FLING_ANIMATOR uses AccelerateDecelerateInterpolator, which is not depending on
|
|
1615
|
+
// the init velocity. We use the overscroller to decide the fling distance.
|
|
1616
|
+
return ReactScrollViewHelper.predictFinalScrollPosition(this, 0, velocityY, 0, getMaxScrollY())
|
|
1617
|
+
.y;
|
|
1618
|
+
}
|
|
1619
|
+
|
|
1620
|
+
public void setPointerEvents(PointerEvents pointerEvents) {
|
|
1621
|
+
mPointerEvents = pointerEvents;
|
|
1622
|
+
}
|
|
1623
|
+
|
|
1624
|
+
public PointerEvents getPointerEvents() {
|
|
1625
|
+
return mPointerEvents;
|
|
1626
|
+
}
|
|
1627
|
+
|
|
1628
|
+
@Override
|
|
1629
|
+
public void setScrollEventThrottle(int scrollEventThrottle) {
|
|
1630
|
+
mScrollEventThrottle = scrollEventThrottle;
|
|
1631
|
+
}
|
|
1632
|
+
|
|
1633
|
+
@Override
|
|
1634
|
+
public int getScrollEventThrottle() {
|
|
1635
|
+
return mScrollEventThrottle;
|
|
1636
|
+
}
|
|
1637
|
+
|
|
1638
|
+
@Override
|
|
1639
|
+
public void setLastScrollDispatchTime(long lastScrollDispatchTime) {
|
|
1640
|
+
mLastScrollDispatchTime = lastScrollDispatchTime;
|
|
1641
|
+
}
|
|
1642
|
+
|
|
1643
|
+
@Override
|
|
1644
|
+
public long getLastScrollDispatchTime() {
|
|
1645
|
+
return mLastScrollDispatchTime;
|
|
1646
|
+
}
|
|
1647
|
+
}
|