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); addViewInLayout(view, -1, ensureLayoutParams(view.getLayoutParams()), true);
} else { } else {
View view = ensureViewHasNoParent(viewResolver.getView(-viewToAdd)); View view = ensureViewHasNoParent(viewResolver.getView(-viewToAdd));
attachViewToParent(view, -1, ensureLayoutParams(view.getLayoutParams()));
if (mRemoveClippedSubviews) { if (mRemoveClippedSubviews) {
mClippedSubviews.remove(-viewToAdd); DrawView drawView = Assertions.assertNotNull(mDrawViewMap.get(-viewToAdd));
DrawView drawView = mDrawViewMap.get(-viewToAdd); // If the view is clipped, we don't need to attach it.
if (drawView != null) { if (!drawView.isViewGroupClipped) {
drawView.isViewGroupClipped = false; attachViewToParent(view, -1, ensureLayoutParams(view.getLayoutParams()));
} }
} else {
attachViewToParent(view, -1, ensureLayoutParams(view.getLayoutParams()));
} }
} }
} }