mirror of
https://github.com/status-im/react-native.git
synced 2025-02-10 08:26:23 +00:00
Prevent RefreshControl from getting stuck when a parent is scrolled horizontally
Reviewed By: achen1 Differential Revision: D8044763 fbshipit-source-id: 8f3351de13eb17d2937f3b9e76500889398f9c59
This commit is contained in:
parent
10814e2e61
commit
33ffa79a51
@ -89,6 +89,14 @@ public class ReactSwipeRefreshLayout extends SwipeRefreshLayout {
|
|||||||
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
||||||
if (shouldInterceptTouchEvent(ev) && super.onInterceptTouchEvent(ev)) {
|
if (shouldInterceptTouchEvent(ev) && super.onInterceptTouchEvent(ev)) {
|
||||||
NativeGestureUtil.notifyNativeGestureStarted(this, ev);
|
NativeGestureUtil.notifyNativeGestureStarted(this, ev);
|
||||||
|
|
||||||
|
// If the pull-to-refresh gesture is interrupted by a parent with its own
|
||||||
|
// onInterceptTouchEvent then the refresh indicator gets stuck on-screen
|
||||||
|
// so we ask the parent to not intercept this touch event after it started
|
||||||
|
if (getParent() != null) {
|
||||||
|
getParent().requestDisallowInterceptTouchEvent(true);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user