From dea6b0e24c85f6d62e8df7fe550c0c055a69ab17 Mon Sep 17 00:00:00 2001 From: Andrei Coman Date: Tue, 6 Sep 2016 09:49:56 -0700 Subject: [PATCH] Fix `requestDisallowInterceptTouchEvent` for nested react native views Summary: ReactRootView currently intercepts and swallows all `requestDisallowInterceptTouchEvent` calls, which made sense when the ReactNativeView was the root of all views. In the context of react native views embedded in other views though, we want to propagate the call to all parents views, but not set it on the ReactRootView itself (because we still need the `onInterceptTouchEvent` calls to dispatch the touch events to JS). Reviewed By: foghina Differential Revision: D3819255 fbshipit-source-id: 21f2dd173c76e98342193de384292fef2b407250 --- .../src/main/java/com/facebook/react/ReactRootView.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java b/ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java index b2bea0d8e..0e03a2606 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java +++ b/ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java @@ -161,8 +161,11 @@ public class ReactRootView extends SizeMonitoringFrameLayout implements RootView @Override public void requestDisallowInterceptTouchEvent(boolean disallowIntercept) { - // No-op - override in order to still receive events to onInterceptTouchEvent - // even when some other view disallow that + // Override in order to still receive events to onInterceptTouchEvent even when some other + // views disallow that, but propagate it up the tree if possible. + if (getParent() != null) { + getParent().requestDisallowInterceptTouchEvent(disallowIntercept); + } } @Override