Skip to content

Commit ee55b39

Browse files
authored
Merge pull request #18 from pbk20191/OnBackPressedDispatcherProvider
install Dialog's OnBackPressedDispatcher
2 parents d9a48c9 + 53564d9 commit ee55b39

File tree

1 file changed

+2
-0
lines changed
  • bottomsheetdialog-compose/src/main/kotlin/com/holix/android/bottomsheetdialog/compose

1 file changed

+2
-0
lines changed

bottomsheetdialog-compose/src/main/kotlin/com/holix/android/bottomsheetdialog/compose/BottomSheetDialog.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import android.graphics.Outline
66
import android.os.Build
77
import android.view.*
88
import androidx.activity.addCallback
9+
import androidx.activity.setViewTreeOnBackPressedDispatcherOwner
910
import androidx.annotation.FloatRange
1011
import androidx.annotation.IntRange
1112
import androidx.annotation.Px
@@ -433,6 +434,7 @@ private class BottomSheetDialogWrapper(
433434
setContentView(bottomSheetDialogLayout)
434435
ViewTreeLifecycleOwner.set(bottomSheetDialogLayout, ViewTreeLifecycleOwner.get(composeView))
435436
ViewTreeViewModelStoreOwner.set(bottomSheetDialogLayout, ViewTreeViewModelStoreOwner.get(composeView))
437+
bottomSheetDialogLayout.setViewTreeOnBackPressedDispatcherOwner(this)
436438
bottomSheetDialogLayout.setViewTreeSavedStateRegistryOwner(
437439
composeView.findViewTreeSavedStateRegistryOwner()
438440
)

0 commit comments

Comments
 (0)