Fix detaching dropped views in Nodes

Summary:
Groups had a crash when running with React with Nodes when returning
from a search screen. This was due to the fact that the node representing a
ShimmerFrameLayout was being dropped, and then later we were trying to detach
it. Since the view was already dropped, we shouldn't try to detach it since
it's already dropped and removed from the view hierarchy.

Reviewed By: sriramramani

Differential Revision: D3004541
This commit is contained in:
Ahmed El-Helw 2016-03-03 13:39:38 -08:00
parent 0b560d3d3d
commit 45472fe400
1 changed files with 7 additions and 0 deletions

View File

@ -109,6 +109,13 @@ import com.facebook.react.uimanager.events.EventDispatcher;
mOnLayoutEvents.clear();
if (!mViewsToDrop.isEmpty()) {
for (int i = 0, mViewsToDropSize = mViewsToDrop.size(); i < mViewsToDropSize; i++) {
// set parent tag to -1 to avoid trying to detach this view
FlatShadowNode shadowNode = mViewsToDrop.get(i);
if (shadowNode.mountsToView()) {
shadowNode.setNativeParentTag(-1);
}
}
mOperationsQueue.enqueueDropViews(collectViewTags(mViewsToDrop));
mViewsToDrop.clear();
}