Fix measureLayout for Nodes

Summary:
For Nodes that don't mount to views, measureLayout wasn't working
because our calls for getting the width and height would return the view delta
bounds, which won't exist for Nodes. #accept2ship

Differential Revision: D3707880
This commit is contained in:
Ahmed El-Helw 2016-08-12 12:16:17 -07:00
parent c3b4286915
commit 3adbf1e822
1 changed files with 14 additions and 2 deletions

View File

@ -184,12 +184,24 @@ import com.facebook.react.views.view.ReactClippingViewGroupHelper;
@Override
public final int getScreenWidth() {
return mViewRight - mViewLeft;
if (mountsToView()) {
return mViewRight - mViewLeft;
} else {
// this is not technically correct since hitSlop affects the NodeRegion, but it's a temporary
// work around for now, since mView{Right,Left} are only set for views
return Math.round(mNodeRegion.mRight - mNodeRegion.mLeft);
}
}
@Override
public final int getScreenHeight() {
return mViewBottom - mViewTop;
if (mountsToView()) {
return mViewBottom - mViewTop;
} else {
// this is not technically correct since hitSlop affects the NodeRegion, but it's a temporary
// work around for now, since mView{Bottom,Top} are only set for views
return Math.round(mNodeRegion.mBottom - mNodeRegion.mTop);
}
}
@Override