Cleanup native view hierarchy when view is dropped.

Differential Revision: D2659738

fb-gh-sync-id: 1c14b8c3c6fabbd0e580777bb94221df6dd98f71
This commit is contained in:
Krzysztof Magiera
2015-11-16 14:27:57 -08:00
committed by facebook-github-bot-7
parent 0f590d1233
commit bd1885b5d4
6 changed files with 47 additions and 14 deletions

View File

@@ -393,12 +393,13 @@ import com.facebook.react.touch.JSResponderHandler;
if (view instanceof ViewGroup && viewManager instanceof ViewGroupManager) {
ViewGroup viewGroup = (ViewGroup) view;
ViewGroupManager viewGroupManager = (ViewGroupManager) viewManager;
for (int i = 0; i < viewGroupManager.getChildCount(viewGroup); i++) {
for (int i = viewGroupManager.getChildCount(viewGroup) - 1; i >= 0; i--) {
View child = viewGroupManager.getChildAt(viewGroup, i);
if (mTagsToViews.get(child.getId()) != null) {
dropView(child);
}
}
viewGroupManager.removeAllViews(viewGroup);
}
mTagsToViews.remove(view.getId());
mTagsToViewManagers.remove(view.getId());