Hello, everyone! :wave: I’m having an issue with ...
# compose
e
Hello, everyone! 👋 I’m having an issue with Experimental
ModalBottomSheetLayout
and screen orientation. If I open the
BottomSheet
in landscape and rotate the screen the app crashes with error
The initial value must have an associated anchor
. An issue tracker was already open for further investigation, but is there any workaround in the meantime? Basically this is the only issue that is preventing me to release my app on Google Play. 😊 Thanks a lot for all your help! ❤️
same 1
a
Hi, it looks like I’ve come across the same problem. As far as can see, the crash happens when the content of the bottom sheet is empty. This code in ModalBottomSheet.kt returns only 1 anchor for Expaned when sheetHeight is 0 as the key is the same for both states.
Copy code
val anchors = if (sheetHeight < fullHeight / 2) {
                mapOf(
                    fullHeight to ModalBottomSheetValue.Hidden,
                    fullHeight - sheetHeight to ModalBottomSheetValue.Expanded
                )
Then I see the actual exception is thrown when it can’t find height for Hidden state… So, I’ve fixed it with an additional top padding…