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
// When the child-parent relation is removed, onDetachedFromWindow will be called.
47
+
// Its important to wait for detaching as the view might be in a transition, and isn't removed immediately.
48
+
child.doOnDetach {
49
+
// Looking at how endViewTransition is implemented, dispatchDetachedFromWindow
50
+
// gets called _before_ the parent relation is removed, so we need to post this to the end of the frame:
51
+
child.post {
52
+
if(operationsMap.remove(parent) ==null) {
53
+
// The addView operation was already countered by a removeView operation while we were waiting
54
+
FLog.w("ReactClippingViewManager", "Tried to add a view to a parent after the child was detached, but a remove operation was already enqueued")
55
+
return@post
56
+
}
57
+
FLog.w("ReactClippingViewManager", "addView(): ${child::class.java.simpleName} had a parent, removed from previous parent and after onDetach adding to new parent $parent")
58
+
callback()
59
+
}
60
+
}
61
+
62
+
// With the detach listener in place, we can now remove the view from the previous parent:
63
+
// Note: This call here is potentially redundant, as SurfaceMountingManager.kt is already removing it
Copy file name to clipboardExpand all lines: packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactClippingViewManager.kt
+6-37Lines changed: 6 additions & 37 deletions
Original file line number
Diff line number
Diff line change
@@ -31,47 +31,16 @@ public abstract class ReactClippingViewManager<T : ReactViewGroup> : ViewGroupMa
// When the child-parent relation is removed, onDetachedFromWindow will be called.
46
-
// Its important to wait for detaching as the view might be in a transition, and isn't removed immediately.
47
-
child.doOnDetach {
48
-
// Looking at how endViewTransition is implemented, dispatchDetachedFromWindow
49
-
// gets called _before_ the parent relation is removed, so we need to post this to the end of the frame:
50
-
child.post {
51
-
if(operationsMap.remove(parent) ==null) {
52
-
// The addView operation was already countered by a removeView operation while we were waiting
53
-
FLog.w("ReactClippingViewManager", "Tried to add a view to a parent after the child was detached, but a remove operation was already enqueued")
54
-
return@post
55
-
}
56
-
FLog.w("ReactClippingViewManager", "addView(): ${child::class.java.simpleName} had a parent, removed from previous parent and after onDetach adding to new parent $parent")
57
-
addViewInternal(parent, child, index)
58
-
}
37
+
addViewSafely(parent, child, index) {
38
+
val removeClippedSubviews = parent.removeClippedSubviews
0 commit comments