mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Allow overriding the horizontal scroll position restore (#54115)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/54115 Horizontal scroll view extensions should be able to customize the scrolling behavior for state restores. This adds the `restoreScrollTo` function that will be called to restore the scroll position to the location provided by the shadow node state. Changelog: [Internal] Reviewed By: rozele Differential Revision: D84310601 fbshipit-source-id: 007caa3d0922a5430ffc6f970eebb180a112f894
This commit is contained in:
committed by
meta-codesync[bot]
parent
78bdf584e2
commit
e926ad0428
@@ -5618,6 +5618,7 @@ public class com/facebook/react/views/scroll/ReactHorizontalScrollView : android
|
||||
public fun pageScroll (I)Z
|
||||
public fun reactSmoothScrollTo (II)V
|
||||
public fun requestChildFocus (Landroid/view/View;Landroid/view/View;)V
|
||||
protected fun restoreScrollTo (II)V
|
||||
public fun scrollTo (II)V
|
||||
public fun scrollToPreservingMomentum (II)V
|
||||
public fun setBackgroundColor (I)V
|
||||
|
||||
+5
-1
@@ -1660,10 +1660,14 @@ public class ReactHorizontalScrollView extends HorizontalScrollView
|
||||
if (ReactNativeFeatureFlags.enableViewCulling()
|
||||
|| ReactNativeFeatureFlags.useTraitHiddenOnAndroid()) {
|
||||
Point scrollPosition = scrollState.getLastStateUpdateScroll();
|
||||
scrollTo(scrollPosition.x, scrollPosition.y);
|
||||
restoreScrollTo(scrollPosition.x, scrollPosition.y);
|
||||
}
|
||||
}
|
||||
|
||||
protected void restoreScrollTo(int x, int y) {
|
||||
scrollTo(x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReactScrollViewScrollState getReactScrollViewScrollState() {
|
||||
return mReactScrollViewScrollState;
|
||||
|
||||
Reference in New Issue
Block a user