Skip to content

Commit 5dbbc8c

Browse files
authored
Merge pull request #9 from holixfactory/task/nested-scroll-connection
enable nested scroll between composable and BottomSheetDialog
2 parents a4f8c30 + ff61c4b commit 5dbbc8c

File tree

1 file changed

+6
-3
lines changed
  • bottomsheetdialog-compose/src/main/kotlin/com/holix/android/bottomsheetdialog/compose

1 file changed

+6
-3
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ import androidx.annotation.IntRange
1010
import androidx.annotation.Px
1111
import androidx.compose.runtime.*
1212
import androidx.compose.runtime.saveable.rememberSaveable
13+
import androidx.compose.ui.ExperimentalComposeUiApi
1314
import androidx.compose.ui.Modifier
1415
import androidx.compose.ui.graphics.Color
1516
import androidx.compose.ui.graphics.compositeOver
1617
import androidx.compose.ui.graphics.luminance
1718
import androidx.compose.ui.graphics.toArgb
19+
import androidx.compose.ui.input.nestedscroll.nestedScroll
1820
import androidx.compose.ui.layout.Layout
1921
import androidx.compose.ui.platform.*
2022
import androidx.compose.ui.semantics.dialog
@@ -245,6 +247,7 @@ private val BlackScrimmed: (Color) -> Color = { original ->
245247
* @param properties [BottomSheetDialogProperties] for further customization of this dialog's behavior.
246248
* @param content The content to be displayed inside the dialog.
247249
*/
250+
@OptIn(ExperimentalComposeUiApi::class)
248251
@Composable
249252
fun BottomSheetDialog(
250253
onDismissRequest: () -> Unit,
@@ -267,10 +270,10 @@ fun BottomSheetDialog(
267270
dialogId
268271
).apply {
269272
setContent(composition) {
270-
// TODO(b/159900354): draw a scrim and add margins around the Compose Dialog, and
271-
// consume clicks so they can't pass through to the underlying UI
272273
BottomSheetDialogLayout(
273-
Modifier.semantics { dialog() },
274+
Modifier
275+
.nestedScroll(rememberNestedScrollInteropConnection())
276+
.semantics { dialog() },
274277
) {
275278
currentContent()
276279
}

0 commit comments

Comments
 (0)