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

bottom sheet state - progress does not expose correct value #53

Open
MFlisar opened this issue Jan 15, 2025 · 0 comments
Open

bottom sheet state - progress does not expose correct value #53

MFlisar opened this issue Jan 15, 2025 · 0 comments

Comments

@MFlisar
Copy link

MFlisar commented Jan 15, 2025

When observing the bottom sheet state I see that the progress jumps to 1 as soon as I drag the bottom sheet to 50% and then it stays there.

LaunchedEffect(sheetState.targetDetent, sheetState.progress, sheetState.offset) {
     println("sheetState.progress = ${sheetState.progress}  | sheetState.offset = ${sheetState.offset} | sheetState.targetDetent = ${sheetState.targetDetent.identifier}")
 }

Logs look like following then:

// ... 
sheetState.progress = 0.5208952  | sheetState.offset = 1149.8516 | sheetState.targetDetent = hidden
sheetState.progress = 0.5164543  | sheetState.offset = 1160.5098 | sheetState.targetDetent = hidden
sheetState.progress = 0.5123608  | sheetState.offset = 1170.334 | sheetState.targetDetent = hidden
sheetState.progress = 0.5083179  | sheetState.offset = 1180.0371 | sheetState.targetDetent = hidden
sheetState.progress = 0.5039864  | sheetState.offset = 1190.4326 | sheetState.targetDetent = hidden
sheetState.progress = 0.50002766  | sheetState.offset = 1199.9336 | sheetState.targetDetent = hidden
sheetState.progress = 1.0  | sheetState.offset = 1208.8184 | sheetState.targetDetent = fully-expanded
sheetState.progress = 1.0  | sheetState.offset = 1217.7559 | sheetState.targetDetent = fully-expanded
sheetState.progress = 1.0  | sheetState.offset = 1225.1719 | sheetState.targetDetent = fully-expanded
sheetState.progress = 1.0  | sheetState.offset = 1232.7891 | sheetState.targetDetent = fully-expanded
// ... 

Seems like the internal logic skips the next best value (the closest inside UnstyledDraggableAnchors) and as a side effect the progress between settled and target instantly becomes 1...

Notes

  • I use version 1.20.0
  • I use a bottom sheet with extended and hidden state only
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

1 participant