Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial state not working and not able to be set. #25

Open
jasoneggleton-benevity opened this issue Apr 12, 2024 · 1 comment
Open

Initial state not working and not able to be set. #25

jasoneggleton-benevity opened this issue Apr 12, 2024 · 1 comment

Comments

@jasoneggleton-benevity
Copy link

  • Library Version : com.github.skydoves:flexible-bottomsheet-material3:0.1.2
  • Affected Device(s) : Pixel 8 Pro SDK 34

Initial state not working or not able to be set.

Tracing the library code, calling rememberFlexibleBottomSheetState calls a private function rememberFlexibleSheetState which has a default parameter of initialValue: FlexibleSheetValue = FlexibleSheetValue.Hidden. The public method does not take that parameter, however, the initial state should evaluate to hidden regardless.

In my most basic implementation, the sheet always starts off a not hidden, intermediately expanded.

 val sheetState = rememberFlexibleBottomSheetState(
      isModal = false
 )

FlexibleBottomSheet(
        windowInsets = WindowInsets(0, 0, 0, 0),
        onDismissRequest = { },
        sheetState = sheetState,
      ) {
        CircularProgressIndicator()
      }
}

It's not clear how to set the initial state, or if it's supported. Am I missing something obvious?

Wrapping the entire FlexibleBottomSheet in an if statement and check some state before showing works, but then it gets awkward to have a nice animation to hide it when that state changes, it would just abruptly disappear.

Expected Behaviour:

  • there is a way to set the initial state value
  • initial state value is respected.
@cacato86
Copy link

cacato86 commented May 9, 2024

I had the same problem, any idea how to solve this @skydoves ?

Checking the code seems relative easy to fix, just adding the initialValue to the public fun rememberFlexibleBottomSheetState would work.

Thanks for your time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants