File tree Expand file tree Collapse file tree
android/src/main/java/com/lodev09/truesheet Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -135,6 +135,11 @@ class TrueSheetView(private val reactContext: ThemedReactContext) :
135135 val child = getChildAt(index)
136136 if (child is TrueSheetContainerView ) {
137137 child.delegate = null
138+
139+ // Dismiss the sheet when container is removed
140+ if (viewController.isPresented) {
141+ viewController.dismiss(animated = false )
142+ }
138143 }
139144 viewController.removeView(child)
140145 }
@@ -159,14 +164,12 @@ class TrueSheetView(private val reactContext: ThemedReactContext) :
159164 fun onDropInstance () {
160165 reactContext.removeLifecycleEventListener(this )
161166
162- if (viewController.isPresented) {
163- viewController.dismiss(animated = false )
164- }
167+ viewController.dismiss()
168+ viewController.delegate = null
165169
166170 TrueSheetModule .unregisterView(id)
167171 TrueSheetStackManager .removeSheet(this )
168172
169- viewController.delegate = null
170173 didInitiallyPresent = false
171174 }
172175
You can’t perform that action at this time.
0 commit comments