Skip to content

Commit

Permalink
Fix scroll on Android patching ReactScrollView
Browse files Browse the repository at this point in the history
  • Loading branch information
francescopersico committed Apr 2, 2019
1 parent 8cf6124 commit 18138c8
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions patches/react-native+0.57.8.patch
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(

0 comments on commit 18138c8

Please sign in to comment.