You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.kt
+133Lines changed: 133 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -69,6 +69,8 @@ import java.util.ArrayList
69
69
importkotlin.concurrent.Volatile
70
70
importkotlin.math.max
71
71
72
+
importcom.facebook.react.bridge.UiThreadUtil
73
+
72
74
/**
73
75
* Backing for a React View. Has support for borders, but since borders aren't common, lazy
74
76
* initializes most of the storage needed for them.
@@ -1027,6 +1029,137 @@ public open class ReactViewGroup public constructor(context: Context?) :
1027
1029
}
1028
1030
1029
1031
//#region debug helper
1032
+
overridefunremoveView(view:View?) {
1033
+
UiThreadUtil.assertOnUiThread()
1034
+
getNativeId()?.let { nativeId ->
1035
+
val viewClass = view?.javaClass?.simpleName ?:"null"
1036
+
val viewIndex = indexOfChild(view)
1037
+
val stack = getStack()
1038
+
val hierarchy = viewHierarchyDescription()
1039
+
FLog.w(
1040
+
"ReactViewGroup",
1041
+
"[$nativeId] removeView called for view of class $viewClass at index $viewIndex\nStack trace:\n$stack\nHierarchy:\n$hierarchy",
1042
+
)
1043
+
}
1044
+
1045
+
super.removeView(view)
1046
+
}
1047
+
1048
+
overridefunremoveViewAt(index:Int) {
1049
+
UiThreadUtil.assertOnUiThread()
1050
+
getNativeId()?.let { nativeId ->
1051
+
val view = getChildAt(index)
1052
+
val viewClass = view?.javaClass?.simpleName ?:"null"
1053
+
val stack = getStack()
1054
+
val hierarchy = viewHierarchyDescription()
1055
+
FLog.w(
1056
+
"ReactViewGroup",
1057
+
"[$nativeId] removeViewAt called for view of class $viewClass at index $index\nStack trace:\n$stack\nHierarchy:\n$hierarchy",
1058
+
)
1059
+
}
1060
+
1061
+
super.removeViewAt(index)
1062
+
}
1063
+
1064
+
overridefunremoveViews(start:Int, count:Int) {
1065
+
UiThreadUtil.assertOnUiThread()
1066
+
getNativeId()?.let { nativeId ->
1067
+
val views = (start until start + count).map { getChildAt(it) }
1068
+
val viewClasses = views.map { it?.javaClass?.simpleName ?:"null" }
1069
+
val stack = getStack()
1070
+
val hierarchy = viewHierarchyDescription()
1071
+
FLog.w(
1072
+
"ReactViewGroup",
1073
+
"[$nativeId] removeViews called for views of classes $viewClasses starting at index $start count $count\nStack trace:\n$stack\nHierarchy:\n$hierarchy",
1074
+
)
1075
+
}
1076
+
1077
+
super.removeViews(start, count)
1078
+
}
1079
+
1080
+
overridefunremoveViewInLayout(view:View?) {
1081
+
UiThreadUtil.assertOnUiThread()
1082
+
getNativeId()?.let { nativeId ->
1083
+
val viewClass = view?.javaClass?.simpleName ?:"null"
1084
+
val viewIndex = indexOfChild(view)
1085
+
val stack = getStack()
1086
+
FLog.w(
1087
+
"ReactViewGroup",
1088
+
"[$nativeId] removeViewInLayout called for view of class $viewClass at index $viewIndex\nStack trace:\n$stack",
val views = (start until start + count).map { getChildAt(it) }
1099
+
val viewClasses = views.map { it?.javaClass?.simpleName ?:"null" }
1100
+
val stack = getStack()
1101
+
val hierarchy = viewHierarchyDescription()
1102
+
FLog.w(
1103
+
"ReactViewGroup",
1104
+
"[$nativeId] removeViewsInLayout called for views of classes $viewClasses starting at index $start count $count\nStack trace:\n$stack\nHierarchy:\n$hierarchy",
1105
+
)
1106
+
}
1107
+
1108
+
super.removeViewsInLayout(start, count)
1109
+
}
1110
+
1111
+
overridefunremoveAllViewsInLayout() {
1112
+
UiThreadUtil.assertOnUiThread()
1113
+
getNativeId()?.let { nativeId ->
1114
+
val views = (0 until childCount).map { getChildAt(it) }
1115
+
val viewClasses = views.map { it?.javaClass?.simpleName ?:"null" }
1116
+
val stack = getStack()
1117
+
val hierarchy = viewHierarchyDescription()
1118
+
FLog.w(
1119
+
"ReactViewGroup",
1120
+
"[$nativeId] removeAllViewsInLayout called for views of classes $viewClasses\nStack trace:\n$stack\nHierarchy:\n$hierarchy",
1121
+
)
1122
+
}
1123
+
1124
+
super.removeAllViewsInLayout()
1125
+
}
1126
+
1127
+
overridefunremoveAllViews() {
1128
+
UiThreadUtil.assertOnUiThread()
1129
+
getNativeId()?.let { nativeId ->
1130
+
val views = (0 until childCount).map { getChildAt(it) }
1131
+
val viewClasses = views.map { it?.javaClass?.simpleName ?:"null" }
1132
+
val stack = getStack()
1133
+
val hierarchy = viewHierarchyDescription()
1134
+
FLog.w(
1135
+
"ReactViewGroup",
1136
+
"[$nativeId] removeAllViews called for views of classes $viewClasses\nStack trace:\n$stack\nHierarchy:\n$hierarchy",
0 commit comments