Add NodeRegion to allow any FlatShadowNode to respond to touch events

Summary: @public When Android dispatches `MotionEvent` to `ReactRootView`, it needs to find a correspoding react node that should receive it. To be able to do it, we need to store boundaries of every `FlatShadowNode` in `FlatViewGroup`. Then we can iterate over node boundaries and find one that contains the touch event coordinates.

Reviewed By: sriramramani

Differential Revision: D2694197
This commit is contained in:
Denis Koroskin
2015-12-13 18:26:10 -08:00
committed by Ahmed El-Helw
parent 8de2acd3a9
commit dad378e394
6 changed files with 118 additions and 8 deletions

View File

@@ -30,14 +30,17 @@ import com.facebook.react.uimanager.UIViewOperationQueue;
private final int mReactTag;
private final @Nullable DrawCommand[] mDrawCommands;
private final @Nullable AttachDetachListener[] mAttachDetachListeners;
private final @Nullable NodeRegion[] mNodeRegions;
private UpdateMountState(
int reactTag,
@Nullable DrawCommand[] drawCommands,
@Nullable AttachDetachListener[] listeners) {
@Nullable AttachDetachListener[] listeners,
@Nullable NodeRegion[] nodeRegions) {
mReactTag = reactTag;
mDrawCommands = drawCommands;
mAttachDetachListeners = listeners;
mNodeRegions = nodeRegions;
}
@Override
@@ -45,7 +48,8 @@ import com.facebook.react.uimanager.UIViewOperationQueue;
mNativeViewHierarchyManager.updateMountState(
mReactTag,
mDrawCommands,
mAttachDetachListeners);
mAttachDetachListeners,
mNodeRegions);
}
}
@@ -119,8 +123,9 @@ import com.facebook.react.uimanager.UIViewOperationQueue;
public void enqueueUpdateMountState(
int reactTag,
@Nullable DrawCommand[] drawCommands,
@Nullable AttachDetachListener[] listeners) {
enqueueUIOperation(new UpdateMountState(reactTag, drawCommands, listeners));
@Nullable AttachDetachListener[] listeners,
@Nullable NodeRegion[] nodeRegions) {
enqueueUIOperation(new UpdateMountState(reactTag, drawCommands, listeners, nodeRegions));
}
public void enqueueUpdateViewGroup(int reactTag, int[] viewsToAdd, int[] viewsToDetach) {