Status Update
Comments
jo...@google.com <jo...@google.com> #3
Thanks for the report!
jo...@google.com <jo...@google.com> #4
The release notes documentation has been edited to clarify this change in behavior for line height.
To support non-standard text sizes, we encourage users to follow the Material design system and use a different style = LocalTextStyle.current.copy(lineHeight = TextUnit.Unspecified)
, or create a custom Typography
entirely.
jo...@google.com <jo...@google.com> #5
jo...@google.com <jo...@google.com> #6
In my case, I have multiple font sizes in the same Text
(using SpanStyle
in AnnotatedString
). There are legitimate reasons for this. For example, when combining Chinese and English (phonetic) together (for language-learning purposes).
ha...@gmail.com <ha...@gmail.com> #7
Thanks for the quick reply!
Would you mind filing a separate issue for this?
Sure, I'll see if I can figure out in which specific conditions it happens and open a new issue
jo...@google.com <jo...@google.com> #8
Thanks! I found a repro (and the cause) for this so just an issue without a repro is totally fine :)
ha...@gmail.com <ha...@gmail.com> #9
Here's the new issue
For some completeness I added a video and a link to the same repo as in this issue
ap...@google.com <ap...@google.com> #10
Branch: androidx-main
commit 43ba01d4fc84edb9495a2089090bcd2f786be743
Author: Jossi Wolf <jossiwolf@google.com>
Date: Mon Jan 16 12:11:00 2023
Handle absence of previous target in ModalBottomSheetAnchorChangeHandler
When we animate or snap, we update the currentValue regardless of whether it exists in the anchors. If ModalBottomSheetState was moved to a visible value (HalfExpanded or Expanded) while only having a hidden anchor (when the sheet content is empty), we would crash in the AnchorChangeHandler because we required the previous target to be present in the previous set of anchors.
Test: modalBottomSheet_shortSheet_anchorChangeHandler_previousTargetNotInAnchors_reconciles, modalBottomSheet_tallSheet_anchorChangeHandler_previousTargetNotInAnchors_reconciles
Relnote: Fixed a bug in ModalBottomSheetLayout where the sheet would crash when going from the hidden to a visible state in some circumstances.
Bug: 265444789
Change-Id: Ia926514a65dc4d2c44781e132f8faae7e442cf68
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ModalBottomSheetTest.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/ModalBottomSheet.kt
jo...@google.com <jo...@google.com>
ha...@gmail.com <ha...@gmail.com> #11
Does this also fix the crash I described in
jo...@google.com <jo...@google.com> #12
Yep, it also fixes that :)
ha...@gmail.com <ha...@gmail.com> #13
Awesome :)
pr...@google.com <pr...@google.com> #14
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.compose.material:material:1.4.0-alpha05
Description
Jetpack Compose version: 1.4.0-alpha04
Jetpack Compose component used: ModalBottomSheetLayout
Android Studio Build: Electric Eel 2022.1.1 #AI-221.6008.13.2211.9477386
Kotlin version: 1.7.21
Repo:https://github.com/hakonschia/bottomsheetcrash
The updated ModalBottomSheetLayout in 1.4.0-alpha04 seems to have some issues. I have observed two cases where it crashes with
Key HalfExpanded is missing in the map
. The linked repo contains both scenarios.First scenario:
I'll add that the bottom sheet "floats" above the bottom of the screen, which seems like a new bug introduced in alpha04. In the example repo this only happens when the sheet is opened in landscape. If I open it in portrait and then rotate, it doesn't happen. It also doesn't crash in this case, so it seems this might be related. This is visible in the video attached.
Second scenario:
The updated ModalBottomSheetLayout is supposed to support empty sheet content, but when going from empty content to some content it crashes.
Steps to reproduce:
I'll add here that I have had to do this hack with empty content to avoid the bottom sheet sometimes being visible when it shouldn't, for example when resizing the window in Picture-in-Picture mode (which might be related to https://issuetracker.google.com/issues/260517771 ). I've added a button to enter PiP where this issue can be seen by removing the logic to not render the content when not visible.
Adding
Spacer(Modifier.height(1.dp))
fixes this crash, which is what I had to do previously anyways since empty content wasn't supported, but I'd like to remove this hack.Stack trace (if applicable):