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

@@ -0,0 +1,29 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
package com.facebook.react.flat;
/* package */ final class NodeRegion {
/* package */ static final NodeRegion[] EMPTY_ARRAY = new NodeRegion[0];
/* package */ static final NodeRegion EMPTY = new NodeRegion(0, 0, 0, 0, -1);
/* package */ final float mLeft;
/* package */ final float mTop;
/* package */ final float mRight;
/* package */ final float mBottom;
/* package */ final int mTag;
/* package */ NodeRegion(float left, float top, float right, float bottom, int tag) {
mLeft = left;
mTop = top;
mRight = right;
mBottom = bottom;
mTag = tag;
}
}