mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-08 22:42:05 +08:00
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:
committed by
Ahmed El-Helw
parent
8de2acd3a9
commit
dad378e394
@@ -25,7 +25,9 @@ import com.facebook.react.uimanager.ViewProps;
|
||||
|
||||
private DrawCommand[] mDrawCommands = DrawCommand.EMPTY_ARRAY;
|
||||
private AttachDetachListener[] mAttachDetachListeners = AttachDetachListener.EMPTY_ARRAY;
|
||||
private NodeRegion[] mNodeRegions = NodeRegion.EMPTY_ARRAY;
|
||||
private FlatShadowNode[] mNativeChildren = FlatShadowNode.EMPTY_ARRAY;
|
||||
private NodeRegion mNodeRegion = NodeRegion.EMPTY;
|
||||
private int mNativeParentTag;
|
||||
private int mViewLeft;
|
||||
private int mViewTop;
|
||||
@@ -135,6 +137,22 @@ import com.facebook.react.uimanager.ViewProps;
|
||||
mNativeParentTag = nativeParentTag;
|
||||
}
|
||||
|
||||
/* package */ final NodeRegion[] getNodeRegions() {
|
||||
return mNodeRegions;
|
||||
}
|
||||
|
||||
/* package */ final void setNodeRegions(NodeRegion[] nodeRegion) {
|
||||
mNodeRegions = nodeRegion;
|
||||
}
|
||||
|
||||
/* package */ final NodeRegion getNodeRegion() {
|
||||
return mNodeRegion;
|
||||
}
|
||||
|
||||
/* package */ final void setNodeRegion(NodeRegion nodeRegion) {
|
||||
mNodeRegion = nodeRegion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets boundaries of the View that this node maps to relative to the parent left/top coordinate.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user