Status Update
Comments
[Deleted User] <[Deleted User]> #2
Never got around to posting the stacktraces + repro, sorry!
Simple repro:
@Composable
fun NoAssociatedStateIssueRepro() {
val state = rememberModalBottomSheetState(ModalBottomSheetValue.HalfExpanded)
ModalBottomSheetLayout(
sheetState = state,
sheetContent = { Box(Modifier.height(56.dp) }
) {
}
}
The same crash can be provoked by having an empty sheet content:
@Composable
fun EmptySheetContentIssueRepro() {
val state = rememberModalBottomSheetState(ModalBottomSheetValue.HalfExpanded)
ModalBottomSheetLayout(
sheetState = state,
sheetContent = { }
) {
}
}
This will crash with
java.lang.IllegalArgumentException: The initial value must have an associated anchor.
at androidx.compose.material.SwipeableState.ensureInit$material_debug(Swipeable.kt:139)
at androidx.compose.material.SwipeableKt$swipeable$3.invoke(Swipeable.kt:579)
at androidx.compose.material.SwipeableKt$swipeable$3.invoke(Swipeable.kt:571)
at androidx.compose.ui.ComposedModifierKt$materialize$result$1.invoke(ComposedModifier.kt:75)
at androidx.compose.ui.ComposedModifierKt$materialize$result$1.invoke(ComposedModifier.kt:70)
at androidx.compose.ui.Modifier$Element$DefaultImpls.foldIn(Modifier.kt:107)
at androidx.compose.ui.ComposedModifier.foldIn(ComposedModifier.kt:47)
at androidx.compose.ui.CombinedModifier.foldIn(Modifier.kt:149)
at androidx.compose.ui.ComposedModifierKt.materialize(ComposedModifier.kt:70)
at androidx.compose.ui.layout.LayoutKt$materializerOf$1.invoke-Deg8D_g(Layout.kt:174)
at androidx.compose.ui.layout.LayoutKt$materializerOf$1.invoke(Layout.kt:173)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.kt:130)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.kt:46)
at androidx.compose.material.ModalBottomSheetKt$ModalBottomSheetLayout$2.invoke-jYbf7pk(ModalBottomSheet.kt:399)
at androidx.compose.material.ModalBottomSheetKt$ModalBottomSheetLayout$2.invoke(ModalBottomSheet.kt:269)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.kt:149)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.kt:46)
at androidx.compose.material.ModalBottomSheetKt$BottomSheetStack$1$1$placeable$1.invoke(ModalBottomSheet.kt:344)
at androidx.compose.material.ModalBottomSheetKt$BottomSheetStack$1$1$placeable$1.invoke(ModalBottomSheet.kt:344)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.kt:121)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.kt:46)
at androidx.compose.ui.layout.SubcomposeLayoutState$subcompose$2$1.invoke(SubcomposeLayout.kt:167)
at androidx.compose.ui.layout.SubcomposeLayoutState$subcompose$2$1.invoke(SubcomposeLayout.kt:167)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.kt:121)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.kt:46)
at androidx.compose.runtime.ComposerKt.invokeComposable(Composer.kt:3422)
at androidx.compose.runtime.ComposerImpl.composeContent$runtime_debug(Composer.kt:2604)
at androidx.compose.runtime.CompositionImpl.composeContent(Composition.kt:348)
at androidx.compose.runtime.Recomposer.composeInitial$runtime_debug(Recomposer.kt:697)
at androidx.compose.runtime.ComposerImpl$CompositionContextImpl.composeInitial$runtime_debug(Composer.kt:3028)
at androidx.compose.runtime.ComposerImpl$CompositionContextImpl.composeInitial$runtime_debug(Composer.kt:3028)
at androidx.compose.runtime.CompositionImpl.setContent(Composition.kt:304)
at androidx.compose.ui.layout.SubcomposeLayoutState.subcomposeInto(SubcomposeLayout.kt:184)
at androidx.compose.ui.layout.SubcomposeLayoutState.access$subcomposeInto(SubcomposeLayout.kt:100)
at androidx.compose.ui.layout.SubcomposeLayoutState$subcompose$2.invoke(SubcomposeLayout.kt:160)
at androidx.compose.ui.layout.SubcomposeLayoutState$subcompose$2.invoke(SubcomposeLayout.kt:158)
at androidx.compose.runtime.snapshots.SnapshotStateObserver.withNoObservations(SnapshotStateObserver.kt:137)
at androidx.compose.ui.node.OwnerSnapshotObserver.withNoSnapshotReadObservation$ui_debug(OwnerSnapshotObserver.kt:49)
at androidx.compose.ui.node.LayoutNode.withNoSnapshotReadObservation$ui_debug(LayoutNode.kt:1086)
at androidx.compose.ui.layout.SubcomposeLayoutState.subcompose(SubcomposeLayout.kt:158)
at androidx.compose.ui.layout.SubcomposeLayoutState.subcompose(SubcomposeLayout.kt:152)
ap...@google.com <ap...@google.com> #3
Thanks Jossi, we'll take a look into it :)
si...@google.com <si...@google.com>
ap...@google.com <ap...@google.com> #4
si...@google.com <si...@google.com> #5
Any updates on this? It still crashes in 1.2.0-beta02
si...@google.com <si...@google.com> #6
No updates for this?
si...@google.com <si...@google.com>
ma...@google.com <ma...@google.com>
ma...@google.com <ma...@google.com> #7
It's still a problem in 1.2.1...
ae...@google.com <ae...@google.com>
si...@google.com <si...@google.com>
gr...@google.com <gr...@google.com>
ap...@google.com <ap...@google.com> #8
There are no updates to share on this yet. We'll update when we have news :)
ap...@google.com <ap...@google.com> #9
Any update on this issue
Fatal Exception: java.lang.IllegalArgumentException: The initial value must have an associated anchor. at androidx.compose.material.SwipeableState.ensureInit$material_release(Swipeable.kt:138) at androidx.compose.material.SwipeableKt$swipeable$3.invoke(Swipeable.kt:594) at androidx.compose.material.SwipeableKt$swipeable$3.invoke(Swipeable.kt:573) at androidx.compose.ui.ComposedModifierKt$materialize$result$1.invoke(ComposedModifier.kt:278) at androidx.compose.ui.ComposedModifierKt$materialize$result$1.invoke(ComposedModifier.kt:273) at androidx.compose.ui.Modifier$Element.foldIn(Modifier.java:110) at androidx.compose.ui.ComposedModifier.foldIn(ComposedModifier.kt) at androidx.compose.ui.CombinedModifier.foldIn(Modifier.kt:152) at androidx.compose.ui.CombinedModifier.foldIn(Modifier.kt:152) at androidx.compose.ui.CombinedModifier.foldIn(Modifier.kt:152) at androidx.compose.ui.CombinedModifier.foldIn(Modifier.kt:152) at androidx.compose.ui.CombinedModifier.foldIn(Modifier.kt:152) at androidx.compose.ui.CombinedModifier.foldIn(Modifier.kt:152) at androidx.compose.ui.CombinedModifier.foldIn(Modifier.kt:152) at androidx.compose.ui.CombinedModifier.foldIn(Modifier.kt:152) at androidx.compose.ui.CombinedModifier.foldIn(Modifier.kt:152) at androidx.compose.ui.CombinedModifier.foldIn(Modifier.kt:152) at androidx.compose.ui.ComposedModifierKt.materialize(ComposedModifier.kt:273) at androidx.compose.ui.layout.LayoutKt$materializerOf$1.invoke-Deg8D_g(Layout.kt:226) at androidx.compose.ui.layout.LayoutKt$materializerOf$1.invoke(Layout.kt:225) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:116) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34) at androidx.compose.animation.AnimatedContentKt$$InternalSyntheticOutline$53$ecb30c9002b8026b405a53f2ba709cfaa8a2c7e1404b01422d70647ebaa2f34c$1.m(AnimatedContentKt.java:2) at androidx.compose.material.SurfaceKt$Surface$1.invoke(Surface.kt:38) at androidx.compose.material.SurfaceKt$Surface$1.invoke(Surface.kt:117) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34) at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228) at androidx.compose.material.SurfaceKt.Surface-F-jzlyU(Surface.kt:114) at androidx.compose.material.ModalBottomSheetKt$ModalBottomSheetLayout$1.invoke(ModalBottomSheet.kt:341) at androidx.compose.material.ModalBottomSheetKt$ModalBottomSheetLayout$1.invoke(ModalBottomSheet.kt:326) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:116) at androidx.compose.runtime.internal.ComposableLambdaImpl$invoke$1.invoke(ComposableLambda.jvm.kt:127) at androidx.compose.runtime.internal.ComposableLambdaImpl$invoke$1.invoke(ComposableLambda.jvm.kt:127) at androidx.compose.runtime.RecomposeScopeImpl.compose(RecomposeScopeImpl.kt:145) at androidx.compose.runtime.ComposerImpl.recomposeToGroupEnd(Composer.kt:2351) at androidx.compose.runtime.ComposerImpl.skipCurrentGroup(Composer.kt:2618) at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:3205) at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:3183) at androidx.compose.runtime.SnapshotStateKt__DerivedStateKt.observeDerivedStateRecalculations(DerivedState.kt:252) at androidx.compose.runtime.SnapshotStateKt.observeDerivedStateRecalculations(SnapshotStateKt.java:1) at androidx.compose.runtime.ComposerImpl.doCompose(Composer.kt:3183) at androidx.compose.runtime.ComposerImpl.recompose$runtime_release(Composer.kt:3148) at androidx.compose.runtime.CompositionImpl.recompose(Composition.kt:746) at androidx.compose.runtime.Recomposer.performRecompose(Recomposer.kt:876) at androidx.compose.runtime.Recomposer.access$performRecompose(Recomposer.kt:107) at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$2.invoke(Recomposer.kt:485) at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$2.invoke(Recomposer.kt:454) at androidx.compose.ui.platform.AndroidUiFrameClock$withFrameNanos$2$callback$1.doFrame(AndroidUiFrameClock.android.kt:34) at androidx.compose.ui.platform.AndroidUiDispatcher.performFrameDispatch(AndroidUiDispatcher.android.kt:109) at androidx.compose.ui.platform.AndroidUiDispatcher.access$performFrameDispatch(AndroidUiDispatcher.android.kt:41) at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.doFrame(AndroidUiDispatcher.android.kt:69) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1106) at android.view.Choreographer.doCallbacks(Choreographer.java:866) at android.view.Choreographer.doFrame(Choreographer.java:792) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1092) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:226) at android.os.Looper.loop(Looper.java:313) at android.app.ActivityThread.main(ActivityThread.java:8669) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
gr...@google.com <gr...@google.com> #10
se...@google.com <se...@google.com> #11
No updates to share yet. We're working on the underlying APIs at the moment to address this properly.
gr...@google.com <gr...@google.com> #12
Branch: androidx-main
commit 3f94eba802caebc95f8f9055ffb572f6ee72ca2e
Author: Levi Albuquerque <levima@google.com>
Date: Thu Mar 16 15:15:20 2023
Migrating BottomDrawer to use SwipeableV2
Move BottomDrawer to use the new SwipeableV2 APIS.
Relnote: Update BottomDrawer internals to use the new SwipeableV2 APIs. Because of this BottomDrawerState will now only have APIS defined at the class level, it won't inherit methods/properties from SwipeableState. We're using composition with an internal SwipeableV2State. Offset is now a nullable floating point property, the current value and a swipe target value can still be accessed through currentValue and targetValue properties. The previous class level methods such as open/expand/close and properties such as isOpen/isClosed continue to be supported.
Test: Updated tests and added new ones.
Fixes: 178529942
Fixes: 220676296
Change-Id: Iad40c08ca8f48afbc451191c788e80584e874b98
M compose/material/material/api/public_plus_experimental_current.txt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/DrawerTest.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/Drawer.kt
Description
Required features:
double/triple click selectionImplementation should be shared between CoreText and CoreTextField
Questions: