Test perf impact of most straightforward fix for double detach.
Summary: This is the most straightforward fix for the double detach issue. If a view is not attached, then addViewInLayout never propagates onAttach, and adding through attachViewToParent is a no op. We could hack something in to attach clipped FlatViewGroups in onClippingRect, but any other view that relies on onAttachedToWindow will have similar issues. Reviewed By: ahmedre Differential Revision: D3560565
This commit is contained in:
parent
95ae936aa6
commit
bb5ba3d295
|
@ -877,18 +877,18 @@ import com.facebook.react.views.view.ReactClippingViewGroupHelper;
|
||||||
// Now off the screen. Don't invalidate in this case, as the canvas should not be
|
// Now off the screen. Don't invalidate in this case, as the canvas should not be
|
||||||
// redrawn unless new elements are coming onscreen.
|
// redrawn unless new elements are coming onscreen.
|
||||||
mClippedSubviews.put(view.getId(), view);
|
mClippedSubviews.put(view.getId(), view);
|
||||||
detachViewFromParent(view);
|
removeViewsInLayout(--index, 1);
|
||||||
drawView.isViewGroupClipped = true;
|
drawView.isViewGroupClipped = true;
|
||||||
index--;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Clipped, invisible.
|
// Clipped, invisible.
|
||||||
if (withinBounds(view, clippingRect)) {
|
if (withinBounds(view, clippingRect)) {
|
||||||
// Now on the screen. Invalidate as we have a new element to draw.
|
// Now on the screen. Invalidate as we have a new element to draw.
|
||||||
attachViewToParent(
|
addViewInLayout(
|
||||||
view,
|
view,
|
||||||
index++,
|
index++,
|
||||||
ensureLayoutParams(view.getLayoutParams()));
|
ensureLayoutParams(view.getLayoutParams()),
|
||||||
|
true);
|
||||||
mClippedSubviews.remove(view.getId());
|
mClippedSubviews.remove(view.getId());
|
||||||
drawView.isViewGroupClipped = false;
|
drawView.isViewGroupClipped = false;
|
||||||
needsInvalidate = true;
|
needsInvalidate = true;
|
||||||
|
|
Loading…
Reference in New Issue