Skip to content

feat: create component - bottom sheet#1150

Open
paulinea wants to merge 50 commits intodevelopfrom
1045-component-create-component---bottom-sheet
Open

feat: create component - bottom sheet#1150
paulinea wants to merge 50 commits intodevelopfrom
1045-component-create-component---bottom-sheet

Conversation

@paulinea
Copy link
Copy Markdown
Member

No description provided.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 13, 2026

snackbarHost = snackbarHost,
containerColor = Color.Transparent,
contentColor = OudsTheme.colorScheme.content.default,
content = content
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few remarks about the parameters:

  • sheetMaxWidth and sheetShape use default values thus do not need to be set.
  • I think containerColor could be exposed in our API, because if a user wants to add a background color, he will add a Box in the content anyway.

) = OudsPreview(theme = theme, darkThemeEnabled = darkThemeEnabled) {
OudsModalBottomSheet(
onDismissRequest = { },
sheetState = rememberModalBottomSheetState()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found an issue in the Paparazzi GitHub repository about the modal bottom sheet snapshots. The fix is to set the initialValue of the sheetState to Expanded:

val density = LocalDensity.current
OudsModalBottomSheet(
    onDismissRequest = { },
    sheetState = remember {
        SheetState(
            skipPartiallyExpanded = true,
            positionalThreshold = { with(density) { 56.dp.toPx() } },
            velocityThreshold = { with(density) { 125.dp.toPx() } },
            initialValue = SheetValue.Expanded,
        )
    },
) 

However the code is a bit verbose because the initialValue cannot be changed with rememberModalBottomSheetState and we must instantiate SheetState directly. As an alternative, this seems to work too:

val sheetState = rememberModalBottomSheetState()
LaunchedEffect(Unit) {
    // This line is needed otherwise the modal bottom sheet is not displayed in snapshots
    sheetState.expand()
}
OudsModalBottomSheet(
    onDismissRequest = { },
    sheetState = sheetState,
) {
    Column(modifier = Modifier.padding(vertical = OudsTheme.spaces.fixed.medium, horizontal = OudsTheme.grids.margin)) {
        Text(text = "Modal bottom sheet content.")
    }
}

But maybe the first solution is more robust because the second one calls expand() asynchronously.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Component] Create component - Bottom Sheet

2 participants