Remove unnecessary view mounting when views are clipped.

Summary: Reduced view attaching by 93% in mountViews.

Reviewed By: ahmedre

Differential Revision: D3477555
This commit is contained in:
Seth Kirby 2016-06-24 11:58:00 -07:00 committed by Ahmed El-Helw
parent e5c81e1c1b
commit 298a3f947b

View File

@ -492,13 +492,14 @@ import com.facebook.react.views.view.ReactClippingViewGroupHelper;
addViewInLayout(view, -1, ensureLayoutParams(view.getLayoutParams()), true);
} else {
View view = ensureViewHasNoParent(viewResolver.getView(-viewToAdd));
attachViewToParent(view, -1, ensureLayoutParams(view.getLayoutParams()));
if (mRemoveClippedSubviews) {
mClippedSubviews.remove(-viewToAdd);
DrawView drawView = mDrawViewMap.get(-viewToAdd);
if (drawView != null) {
drawView.isViewGroupClipped = false;
DrawView drawView = Assertions.assertNotNull(mDrawViewMap.get(-viewToAdd));
// If the view is clipped, we don't need to attach it.
if (!drawView.isViewGroupClipped) {
attachViewToParent(view, -1, ensureLayoutParams(view.getLayoutParams()));
}
} else {
attachViewToParent(view, -1, ensureLayoutParams(view.getLayoutParams()));
}
}
}