Don't add empty NodeRegion, because it will never receive touch events anyway

Summary: Small optimization that prevents empty NodeRegions from being collected. Those will never receive touch events anyway, so why bother allocating memory and iterating over them?

Reviewed By: ahmedre

Differential Revision: D2816355
This commit is contained in:
Denis Koroskin 2016-01-11 20:03:21 -08:00 committed by Ahmed El-Helw
parent 584cbd3b99
commit 03637dc70d
1 changed files with 5 additions and 0 deletions

View File

@ -150,6 +150,11 @@ import com.facebook.react.uimanager.events.EventDispatcher;
float top,
float right,
float bottom) {
if (left == right || top == bottom) {
// no point in adding an empty NodeRegion
return;
}
node.updateNodeRegion(left, top, right, bottom);
mNodeRegions.add(node.getNodeRegion());
}