Skip to content

Wrong initial scroll position when toolbar has dynamic height #103

@Veeksi

Description

@Veeksi

My toolbar is built with ConstraintLayout and it depends on WindowInsets so I can calculate statusBarHeight like this:

toolbar = {
    val paddingValues = WindowInsets.systemBars.asPaddingValues()

    Box(
        modifier = Modifier
            .padding(top = paddingValues.calculateTopPadding())
            .fillMaxWidth()
            .height(300.dp),
        contentAlignment = Alignment.BottomCenter
    ) {
        Text("Hello")
    }
}

When my toolbar container has dynamic height, the initial scrolling position is wrong because it doesn't care about dynamic statusBarHeight. You can reproduce the issue by placing those components into toolbar scope.

I am using scrollStrategy = ScrollStrategy.ExitUntilCollapsed,

You can see the actual problem in the video: https://streamable.com/i4gwqm

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions