-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix scroll on Android patching ReactScrollView
- Loading branch information
1 parent
8cf6124
commit 18138c8
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
patch-package | ||
--- a/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java | ||
+++ b/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java | ||
@@ -49,7 +49,7 @@ public class ReactScrollView extends ScrollView implements ReactClippingViewGrou | ||
private static boolean sTriedToGetScrollerField = false; | ||
|
||
private final OnScrollDispatchHelper mOnScrollDispatchHelper = new OnScrollDispatchHelper(); | ||
- private final @Nullable OverScroller mScroller; | ||
+ private @Nullable OverScroller mScroller; | ||
private final VelocityHelper mVelocityHelper = new VelocityHelper(); | ||
private final Rect mRect = new Rect(); // for reuse to avoid allocation | ||
|
||
@@ -320,6 +320,12 @@ public class ReactScrollView extends ScrollView implements ReactClippingViewGrou | ||
// as there is content. See #onOverScrolled() to see the second part of this change which properly | ||
// aborts the scroller animation when we get to the bottom of the ScrollView content. | ||
|
||
+ OverScroller scroller = getOverScrollerFromParent(); | ||
+ | ||
+ if (mScroller != scroller) { | ||
+ mScroller = scroller; | ||
+ } | ||
+ | ||
int scrollWindowHeight = getHeight() - getPaddingBottom() - getPaddingTop(); | ||
|
||
mScroller.fling( | ||
|