Ignore touch events on layout only Nodes

Summary:
Before this patch, each Node would always generate a node
region, representing the bounds of this particular Node. This set of Nodes was
used when handling touch to figure out whether we should intercept touch (i.e.
a flat Node is catching the draw), or let Android handle touch (i.e. a Node
mounted to a View will handle the touch).

This patch modifies the list of NodeRegions to exclude any Nodes that draw
nothing at all. These Nodes, having no draw output, are effectively layout
containers used to group items, so they shouldn't handle touch.

Reviewed By: sriramramani

Differential Revision: D4369484

fbshipit-source-id: 71b41611873580631f1639f368fa8d971995874f
This commit is contained in:
Ahmed El-Helw
2016-12-28 18:40:40 -08:00
committed by Facebook Github Bot
parent 2249af16b7
commit e380d6d0fd
5 changed files with 35 additions and 1 deletions

View File

@@ -261,7 +261,9 @@ import com.facebook.react.uimanager.events.EventDispatcher;
}
node.updateNodeRegion(left, top, right, bottom, isVirtual);
mNodeRegions.add(node.getNodeRegion());
if (node.doesDraw()) {
mNodeRegions.add(node.getNodeRegion());
}
}
/**