Add android log when trying to add a view into a non viewGroup

Summary:
Easy diff to add extra logging when Fabric tries to add a view inside a view that is not a ViewGroup

changelog: [internal]

Reviewed By: JoshuaGross

Differential Revision: D19737506

fbshipit-source-id: ecb858820de7befc385e725c45b537359e39c0e7
This commit is contained in:
David Vacca
2020-02-04 18:54:22 -08:00
committed by Facebook Github Bot
parent 928fe129db
commit 8dcab66e4b
@@ -18,6 +18,7 @@ import androidx.annotation.AnyThread;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.UiThread;
import com.facebook.common.logging.FLog;
import com.facebook.infer.annotation.Assertions;
import com.facebook.infer.annotation.ThreadConfined;
import com.facebook.react.bridge.ReactNoCrashSoftException;
@@ -113,6 +114,17 @@ public class MountingManager {
public void addViewAt(int parentTag, int tag, int index) {
UiThreadUtil.assertOnUiThread();
ViewState parentViewState = getViewState(parentTag);
if (!(parentViewState.mView instanceof ViewGroup)) {
String message =
"Unable to add a view into a view that is not a ViewGroup. ParentTag: "
+ parentTag
+ " - Tag: "
+ tag
+ " - Index: "
+ index;
FLog.e(TAG, message);
throw new IllegalStateException(message);
}
final ViewGroup parentView = (ViewGroup) parentViewState.mView;
ViewState viewState = getViewState(tag);
final View view = viewState.mView;