Getting an exception when using `bottomSheet` from...
# compose
c
Getting an exception when using
bottomSheet
from accompanist:
Copy code
java.lang.IllegalArgumentException: The target value must have an associated anchor.
    at androidx.compose.material.SwipeableState$snapTo$$inlined$collect$1.emit(Collect.kt:136)
    at kotlinx.coroutines.flow.FlowKt__LimitKt.emitAbort$FlowKt__LimitKt(Limit.kt:73)
    at kotlinx.coroutines.flow.FlowKt__LimitKt.access$emitAbort$FlowKt__LimitKt(Limit.kt:1)
    at kotlinx.coroutines.flow.FlowKt__LimitKt$take$2$1.emit(Limit.kt:63)
    at androidx.compose.material.SwipeableState$special$$inlined$filter$1$2.emit(Collect.kt:137)
    at kotlinx.coroutines.flow.internal.SafeCollectorKt$emitFun$1.invoke(SafeCollector.kt:15)
    at kotlinx.coroutines.flow.internal.SafeCollectorKt$emitFun$1.invoke(SafeCollector.kt:15)
    at kotlinx.coroutines.flow.internal.SafeCollector.emit(SafeCollector.kt:77)
    at kotlinx.coroutines.flow.internal.SafeCollector.emit(SafeCollector.kt:59)
    at androidx.compose.runtime.SnapshotStateKt__SnapshotFlowKt$snapshotFlow$1.invokeSuspend(SnapshotFlow.kt:134)
    at androidx.compose.runtime.SnapshotStateKt__SnapshotFlowKt$snapshotFlow$1.invoke(Unknown Source:8)
    at androidx.compose.runtime.SnapshotStateKt__SnapshotFlowKt$snapshotFlow$1.invoke(Unknown Source:4)
    at kotlinx.coroutines.flow.SafeFlow.collectSafely(Builders.kt:61)
    at kotlinx.coroutines.flow.AbstractFlow.collect(Flow.kt:227)
    at androidx.compose.material.SwipeableState$special$$inlined$filter$1.collect(SafeCollector.common.kt:114)
    at kotlinx.coroutines.flow.FlowKt__LimitKt$take$$inlined$unsafeFlow$1.collect(SafeCollector.common.kt:115)
    at androidx.compose.material.SwipeableState.snapTo(Swipeable.kt:943)
    at com.google.accompanist.navigation.material.SheetContentHostKt.internalHide(SheetContentHost.kt:188)
    at com.google.accompanist.navigation.material.SheetContentHostKt.access$internalHide(SheetContentHost.kt:1)
    at com.google.accompanist.navigation.material.SheetContentHostKt$SheetContentHost$2$2$1.invokeSuspend(SheetContentHost.kt:145)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
    at androidx.compose.ui.platform.AndroidUiDispatcher.performTrampolineDispatch(AndroidUiDispatcher.android.kt:81)
    at androidx.compose.ui.platform.AndroidUiDispatcher.access$performTrampolineDispatch(AndroidUiDispatcher.android.kt:41)
    at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.run(AndroidUiDispatcher.android.kt:57)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:246)
    at android.app.ActivityThread.main(ActivityThread.java:8633)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
How should I fix this up? As per this SO question, the fix should be by mentioning the minHeight as 1 dp: https://stackoverflow.com/questions/68623965/jetpack-compose-modalbottomsheetlayout-throws-java-lang-illegalargumentexception But this solution doesn't work for me.
j
There is a similar issue that has been filed. Do you have a reliable repro?