Hi folks! Curious if anyone ever has this runtime ...
# compose
m
Hi folks! Curious if anyone ever has this runtime crashed when using
ModalBottomSheetState
See error log in 🧵
jetpack compose 1
🟢 1
Copy code
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.kt:110)
       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.material.SurfaceKt$Surface$1.invoke(Surface.kt:675)
       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(: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:1029)
       at android.view.Choreographer.doCallbacks(Choreographer.java:854)
       at android.view.Choreographer.doFrame(Choreographer.java:785)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1016)
       at android.os.Handler.handleCallback(Handler.java:883)
       at android.os.Handler.dispatchMessage(Handler.java:100)
       at android.os.Looper.loop(Looper.java:224)
       at android.app.ActivityThread.main(ActivityThread.java:7590)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
z
Please sent your modalBottomsheet content Composable
It means that if state is not error there is nothing to show in modal sheet that is the very reason of
IllegalArgumentException
add else branch and render a box of atleast 1.dp height.
m
👌 thanks, the solutions works! 🙏
j
I think it is fixed in the newest alpha