fix NullPointerException Caused by manageChildren

Summary: Closes https://github.com/facebook/react-native/pull/8991

Differential Revision: D3612777

Pulled By: dmmiller

fbshipit-source-id: d8da5ef8354cdaf55d8a3efbc2bfbc2aef74a044
This commit is contained in:
ASCE1885 2016-07-25 02:25:43 -07:00 committed by Facebook Github Bot 7
parent feb2825757
commit c21d3a1029
1 changed files with 15 additions and 12 deletions

View File

@ -9,9 +9,6 @@
package com.facebook.react.uimanager;
import javax.annotation.Nullable;
import javax.annotation.concurrent.NotThreadSafe;
import android.content.res.Resources;
import android.util.SparseArray;
import android.util.SparseBooleanArray;
@ -39,6 +36,9 @@ import com.facebook.react.uimanager.layoutanimation.LayoutAnimationListener;
import com.facebook.systrace.Systrace;
import com.facebook.systrace.SystraceMessage;
import javax.annotation.Nullable;
import javax.annotation.concurrent.NotThreadSafe;
/**
* Delegate of {@link UIManagerModule} that owns the native view hierarchy and mapping between
* native view names used in JS and corresponding instances of {@link ViewManager}. The
@ -232,17 +232,20 @@ public class NativeViewHierarchyManager {
@Nullable int[] tagsToDelete) {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("View tag:" + viewToManage.getId() + "\n");
stringBuilder.append(" children(" + viewManager.getChildCount(viewToManage) + "): [\n");
for (int index=0; index<viewManager.getChildCount(viewToManage); index+=16) {
for (int innerOffset=0;
((index+innerOffset) < viewManager.getChildCount(viewToManage)) && innerOffset < 16;
innerOffset++) {
stringBuilder.append(viewManager.getChildAt(viewToManage, index+innerOffset).getId() + ",");
if (null != viewToManage) {
stringBuilder.append("View tag:" + viewToManage.getId() + "\n");
stringBuilder.append(" children(" + viewManager.getChildCount(viewToManage) + "): [\n");
for (int index=0; index<viewManager.getChildCount(viewToManage); index+=16) {
for (int innerOffset=0;
((index+innerOffset) < viewManager.getChildCount(viewToManage)) && innerOffset < 16;
innerOffset++) {
stringBuilder.append(viewManager.getChildAt(viewToManage, index+innerOffset).getId() + ",");
}
stringBuilder.append("\n");
}
stringBuilder.append("\n");
stringBuilder.append(" ],\n");
}
stringBuilder.append(" ],\n");
if (indicesToRemove != null) {
stringBuilder.append(" indicesToRemove(" + indicesToRemove.length + "): [\n");
for (int index = 0; index < indicesToRemove.length; index += 16) {