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 коммит произвёл Ahmed El-Helw
Родитель 584cbd3b99
Коммит 03637dc70d
1 изменённых файлов: 5 добавлений и 0 удалений

Просмотреть файл

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