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:
Oleg Lokhvitsky 2018-05-21 11:09:52 -07:00 committed by Facebook Github Bot
parent 10814e2e61
commit 33ffa79a51

View File

@ -89,6 +89,14 @@ public class ReactSwipeRefreshLayout extends SwipeRefreshLayout {
public boolean onInterceptTouchEvent(MotionEvent ev) {
if (shouldInterceptTouchEvent(ev) && super.onInterceptTouchEvent(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 false;