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
This commit is contained in:
Andrei Coman 2016-09-06 09:49:56 -07:00 committed by Facebook Github Bot 0
parent 372d001a5d
commit dea6b0e24c

View File

@ -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