adrielcafe / voyager

🛸 A pragmatic navigation library for Jetpack Compose
https://voyager.adriel.cafe
MIT License
2.27k stars 109 forks source link

Fix: BottomSheet closes when recomposing in iOS #330 #362

Closed hm-tamim closed 1 month ago

hm-tamim commented 2 months ago

Issue details: https://github.com/adrielcafe/voyager/issues/330 Affected Platform: iOS Compose version: 1.6.0

It seems the culprit is confirmValueChange in rememberModalBottomSheetState, it's using rememberSaveable where confirmValueChange is used as a key. When this method changes in iOS somehow when you open keyboard or any other thing that causes recomposition, it recreates the sheet state, which hides the bottom sheet modal.

Removing confirmValueChange and using LaunchedEffect to observe sheetState.currentValue solves the issue.

DevSrSouza commented 2 months ago

Can we also report this on Compose Multiplatform Issues ? It should not have different behaviors, the same code in both platforms.

hm-tamim commented 2 months ago

Hi @DevSrSouza

I think this one is related https://github.com/JetBrains/compose-multiplatform/issues/4434

hm-tamim commented 2 months ago

Also this one

https://github.com/JetBrains/compose-multiplatform/issues/4435

creativedrewy commented 1 month ago

Thank you for this PR! I just saw this issue myself. Plz cut a new alpha release?