Status Update
Comments
jo...@google.com <jo...@google.com> #3
Thanks for the report!
se...@google.com <se...@google.com>
ap...@google.com <ap...@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.
ap...@google.com <ap...@google.com> #5
se...@google.com <se...@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).
ro...@veeva.com <ro...@veeva.com> #7
This is marked as fixed but doesn't seem to be part of
jo...@google.com <jo...@google.com> #8
We mark issues as fixed as soon as the fix is merged, not when the fix is included in a release. We will provide updates on this issue once the fix gets released.
While Compose releases are scheduled for roughly every two weeks, we don't commit to certain release times. Appreciate the patience!
pr...@google.com <pr...@google.com> #9
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.compose.material3:material3:1.2.0-alpha07
androidx.compose.material3:material3-android:1.2.0-alpha07
64...@gmail.com <64...@gmail.com> #10
the sheet doesn't crash in the alpha07
but it directly starts in a half-expanded state (?!). i didn't have the chance to test if it's something particular to my code, but this was not happening on alpha04
and previous versions.
jo...@google.com <jo...@google.com> #11
#10, please file a new issue with an isolated repro so we can take a look.
64...@gmail.com <64...@gmail.com> #12
#11, sure, here's a sample code to reproduce it:
class MainActivity : ComponentActivity() {
@OptIn(ExperimentalMaterial3Api::class)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
val scaffoldState = rememberBottomSheetScaffoldState(
bottomSheetState = rememberStandardBottomSheetState(
initialValue = SheetValue.Hidden,
skipHiddenState = false
)
)
val scope = rememberCoroutineScope()
BottomSheetTheme {
BottomSheetScaffold(
scaffoldState = scaffoldState,
sheetContent = {
Text("This is the sheet")
}
) {
Button(onClick = {scope.launch {
if (scaffoldState.bottomSheetState.isVisible) {
scaffoldState.bottomSheetState.hide()
} else {
scaffoldState.bottomSheetState.expand()
}
}}) {
Text("Expand/Collapse")
}
}
}
}
}
}
while at it, it would be great to be able to switch the current StandardBottomSheet
for the ModalBottomSheet
(i created a separate issue for it:
jo...@google.com <jo...@google.com>
je...@gmail.com <je...@gmail.com> #13
I hope this fix is not included on androidx.compose.material3:material3:1.2.0-alpha08 also ?
I am facing the similar crash when i configure skipPartiallyExpanded as true. If i set the flag value to false, everything looks good. But, I want the bottom sheet to be hidden for my usecase and i don't want the partial expanded option too .
val scaffoldState = rememberBottomSheetScaffoldState(
bottomSheetState = SheetState(
skipPartiallyExpanded = true,
density = LocalDensity.current,
)
)
BottomSheetScaffold(
modifier = Modifier.fillMaxWidth(),
scaffoldState = scaffoldState,
sheetShape = RoundedCornerShape(topStart = 10.dp, topEnd = 10.dp),
sheetContent = {
Spacer(modifier = Modifier.height(1.dp))
// Sheet content
}
}
) {
Scaffold { // Page conent. }
}
Thanks in advance for looking out this one .
Stack trace:
java.lang.IllegalStateException: The offset was read before being initialized. Did you access the offset in a phase before layout, like effects or composition?
at androidx.compose.material3.AnchoredDraggableState.requireOffset(AnchoredDraggable.kt:345)
at androidx.compose.material3.SheetState.requireOffset(SheetDefaults.kt:166)
at androidx.compose.material3.BottomSheetScaffoldKt$BottomSheetScaffold$3$1.invoke(BottomSheetScaffold.kt:128)
at androidx.compose.material3.BottomSheetScaffoldKt$BottomSheetScaffold$3$1.invoke(BottomSheetScaffold.kt:128)
at androidx.compose.material3.BottomSheetScaffoldKt$BottomSheetScaffoldLayout$2$1$1.invoke(BottomSheetScaffold.kt:363)
at androidx.compose.material3.BottomSheetScaffoldKt$BottomSheetScaffoldLayout$2$1$1.invoke(BottomSheetScaffold.kt:362)
at androidx.compose.ui.layout.MeasureScope$layout$1.placeChildren(MeasureScope.kt:70)
at androidx.compose.ui.layout.LayoutNodeSubcompositionsState$createMeasurePolicy$1$measure-3p2s80s$$inlined$createMeasureResult$2.placeChildren(SubcomposeLayout.kt:951)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate$LookaheadPassDelegate$layoutChildren$1.invoke(LayoutNodeLayoutDelegate.kt:1093)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate$LookaheadPassDelegate$layoutChildren$1.invoke(LayoutNodeLayoutDelegate.kt:1088)
at androidx.compose.runtime.snapshots.Snapshot$Companion.observe(Snapshot.kt:2303)
at androidx.compose.runtime.snapshots.SnapshotStateObserver$ObservedScopeMap.observe(SnapshotStateObserver.kt:496)
at androidx.compose.runtime.snapshots.SnapshotStateObserver.observeReads(SnapshotStateObserver.kt:256)
at androidx.compose.ui.node.OwnerSnapshotObserver.observeReads$ui_release(OwnerSnapshotObserver.kt:133)
at androidx.compose.ui.node.OwnerSnapshotObserver.observeLayoutSnapshotReads$ui_release(OwnerSnapshotObserver.kt:81)
at androidx.compose.ui.node.OwnerSnapshotObserver.observeLayoutSnapshotReads$ui_release$default(OwnerSnapshotObserver.kt:75)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate$LookaheadPassDelegate.layoutChildren(LayoutNodeLayoutDelegate.kt:1088)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate$LookaheadPassDelegate.onNodePlaced$ui_release(LayoutNodeLayoutDelegate.kt:1470)
at androidx.compose.ui.node.InnerNodeCoordinator$LookaheadDelegateImpl.placeChildren(InnerNodeCoordinator.kt:97)
at androidx.compose.ui.node.LookaheadDelegate.placeAt-f8xVGno(LookaheadDelegate.kt:156)
at androidx.compose.ui.layout.Placeable.access$placeAt-f8xVGno(Placeable.kt:34)
at androidx.compose.ui.layout.Placeable$PlacementScope.place-70tqf50(Placeable.kt:463)
at androidx.compose.ui.layout.Placeable$PlacementScope.place-70tqf50$default(Placeable.kt:231)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate$LookaheadPassDelegate$placeAt$1.invoke(LayoutNodeLayoutDelegate.kt:1317)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate$LookaheadPassDelegate$placeAt$1.invoke(LayoutNodeLayoutDelegate.kt:1315)
at androidx.compose.runtime.snapshots.Snapshot$Companion.observe(Snapshot.kt:2303)
at androidx.compose.runtime.snapshots.SnapshotStateObserver$ObservedScopeMap.observe(SnapshotStateObserver.kt:496)
at androidx.compose.runtime.snapshots.SnapshotStateObserver.observeReads(SnapshotStateObserver.kt:256)
at androidx.compose.ui.node.OwnerSnapshotObserver.observeReads$ui_release(OwnerSnapshotObserver.kt:133)
at androidx.compose.ui.node.OwnerSnapshotObserver.observeLayoutModifierSnapshotReads$ui_release(OwnerSnapshotObserver.kt:96)
at androidx.compose.ui.node.OwnerSnapshotObserver.observeLayoutModifierSnapshotReads$ui_release$default(OwnerSnapshotObserver.kt:90)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate$LookaheadPassDelegate.placeAt-f8xVGno(LayoutNodeLayoutDelegate.kt:1315)
at androidx.compose.ui.layout.Placeable.access$placeAt-f8xVGno(Placeable.kt:34)
at androidx.compose.ui.layout.Placeable$PlacementScope.place(Placeable.kt:460)
sh...@gmail.com <sh...@gmail.com> #14
It still happens in androidx.compose.material3:material3:1.2.0-beta01
val scaffoldState = rememberBottomSheetScaffoldState(
bottomSheetState = rememberStandardBottomSheetState(
initialValue = SheetValue.Hidden,
skipHiddenState = true,
),
)
BottomSheetScaffold(
scaffoldState = scaffoldState,
sheetContent = {
Text(
modifier = Modifier
.fillMaxWidth()
.padding(8.dp),
text = "This is Flexible Bottom Sheet",
textAlign = TextAlign.Center,
color = Color.White,
style = MaterialTheme.typography.bodySmall
)
},
sheetPeekHeight = 0.dp,
contentColor = BottomSheetBackgroundColor,
modifier = Modifier.fillMaxSize(),
) {
Text("Hello")
}
LaunchedEffect(scaffoldState.bottomSheetState) {
if (!scaffoldState.bottomSheetState.isVisible) {
onDismiss()
}
}
se...@google.com <se...@google.com>
se...@google.com <se...@google.com> #15
The crash you are seeing appears to be intended. If you set skipHiddenState to true, the initial value must instead be partially expanded or expanded.
an...@gmail.com <an...@gmail.com> #16
I still get crash when initializing state like this:
val scaffoldState = rememberBottomSheetScaffoldState(
bottomSheetState = SheetState(
skipPartiallyExpanded = true,
density = LocalDensity.current,
)
)
Using
androidx.compose.material3:material3-android:1.2.0
al...@gmail.com <al...@gmail.com> #17
at androidx.compose.material3.AnchoredDraggableState.requireOffset(AnchoredDraggable.kt:344)
at androidx.compose.material3.SheetState.requireOffset(SheetDefaults.kt:164)
at androidx.compose.material3.BottomSheetScaffoldKt$BottomSheetScaffold$3$1.invoke(BottomSheetScaffold.kt:131)
ph...@gmail.com <ph...@gmail.com> #18
at androidx.compose.material.SwipeableV2State.requireOffset(SwipeableV2.kt:208)
at androidx.compose.material.BottomSheetState.requireOffset(BottomSheetScaffold.kt:159)
at androidx.compose.material.BottomSheetScaffoldKt$BottomSheetScaffold$child$1$3$1.invoke(BottomSheetScaffold.kt:369)
at androidx.compose.material.BottomSheetScaffoldKt$BottomSheetScaffold$child$1$3$1.invoke(BottomSheetScaffold.kt:369)
at androidx.compose.material.BottomSheetScaffoldKt$BottomSheetScaffoldLayout$1$1.invoke-0kLqBqw(BottomSheetScaffold.kt:495)
at androidx.compose.material.BottomSheetScaffoldKt$BottomSheetScaffoldLayout$1$1.invoke(BottomSheetScaffold.kt:488)
at androidx.compose.ui.layout.LayoutNodeSubcompositionsState$createMeasurePolicy$1.measure-3p2s80s(SubcomposeLayout.kt:598)
at androidx.compose.ui.node.InnerNodeCoordinator.measure-BRTryo0(InnerNodeCoordinator.kt:103)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasure$2.invoke(LayoutNodeLayoutDelegate.kt:1090)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasure$2.invoke(LayoutNodeLayoutDelegate.kt:1086)
at androidx.compose.runtime.snapshots.Snapshot$Companion.observe(Snapshot.kt:2200)
Compose Version: 1.2.1
androidx-compose-material3 = { group = "androidx.compose.material3", name = "material3", version.ref = "androidxComposeMaterial3" }
I still get this error. Please help me
Description
Jetpack Compose version: 1.6.0-alpha03
Jetpack Compose component used: material3
Android Studio Build: Android Studio Hedgehog | 2023.1.1 Canary 15
Kotlin version: 1.9.0
After upgrading from androidx.compose.material3:material3-android:1.2.0-alpha04 to -alpha05 a BottomSheetScaffold crashes when contained in a NavHost in SwipeableV2State code
Steps to Reproduce or Code Sample to Reproduce:
1. Create a project with this content or used the attached sample
and these dependencies
Everything works as expected
2.
Change
"androidx.compose.material3:material3-android:1.2.0-alpha04"
to"androidx.compose.material3:material3-android:1.2.0-alpha05"
3.
Observe the app immediately crash
Stack trace (if applicable):