Thread
#compose
    s

    Se7eN

    1 year ago
    I'm using
    ModalBottomSheetLayout
    with
    BottomSheetScaffold
    . I have a
    TextField
    in the sheetContent of
    BottomSheetScaffold
    but I'm getting a crash when the
    TextField
    goes out of focus or I hide the keyboard. Is this a bug or am I not supposed to use
    ModalBottomSheet
    and
    BottomSheetScaffold
    together?
    java.util.NoSuchElementException: Key 2072.0 is missing in the map.
            at kotlin.collections.MapsKt__MapWithDefaultKt.getOrImplicitDefaultNullable(MapWithDefault.kt:24)
            at kotlin.collections.MapsKt__MapsKt.getValue(Maps.kt:344)
            at androidx.compose.material.SwipeableKt$swipeable$3$3$1.invoke(Swipeable.kt:578)
            at androidx.compose.material.SwipeableKt$swipeable$3$3$1.invoke(Swipeable.kt:577)
            at androidx.compose.material.SwipeableKt.computeTarget(Swipeable.kt:765)
            at androidx.compose.material.SwipeableKt.access$computeTarget(Swipeable.kt:1)
            at androidx.compose.material.SwipeableState.getTargetValue(Swipeable.kt:223)
            at androidx.compose.material.ModalBottomSheetKt$ModalBottomSheetLayout$2.invoke-jYbf7pk(ModalBottomSheet.kt:296)
            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:3418)
            at androidx.compose.runtime.ComposerImpl.composeContent$runtime_release(Composer.kt:2600)
            at androidx.compose.runtime.CompositionImpl.composeContent(Composition.kt:348)
            at androidx.compose.runtime.Recomposer.composeInitial$runtime_release(Recomposer.kt:693)
            at androidx.compose.runtime.ComposerImpl$CompositionContextImpl.composeInitial$runtime_release(Composer.kt:3024)
            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_release(OwnerSnapshotObserver.kt:49)
            at androidx.compose.ui.node.LayoutNode.withNoSnapshotReadObservation$ui_release(LayoutNode.kt:1085)
            at androidx.compose.ui.layout.SubcomposeLayoutState.subcompose(SubcomposeLayout.kt:158)
            at androidx.compose.ui.layout.SubcomposeLayoutState.subcompose(SubcomposeLayout.kt:152)
            at androidx.compose.material.ModalBottomSheetKt$BottomSheetStack$1$1.invoke-0kLqBqw(ModalBottomSheet.kt:344)
            at androidx.compose.material.ModalBottomSheetKt$BottomSheetStack$1$1.invoke(ModalBottomSheet.kt:336)
            at androidx.compose.ui.layout.SubcomposeLayoutState$createMeasurePolicy$1.measure-3p2s80s(SubcomposeLayout.kt:212)
            at androidx.compose.ui.node.InnerPlaceable.performMeasure-BRTryo0(InnerPlaceable.kt:45)
            at androidx.compose.ui.node.LayoutNodeWrapper.measure-BRTryo0(LayoutNodeWrapper.kt:156)
            at androidx.compose.ui.node.OuterMeasurablePlaceable$remeasure$2.invoke(OuterMeasurablePlaceable.kt:94)
            at androidx.compose.ui.node.OuterMeasurablePlaceable$remeasure$2.invoke(OuterMeasurablePlaceable.kt:93)
    b

    Bradleycorn

    1 year ago
    Based on your experience and mine, I think there's a reason why
    ModalBottomSheetLayout
    requires
    @ExperimentalMaterialApi
    .... Seems buggy,
    s

    Se7eN

    1 year ago
    Well there are still bugs in some parts of compose especially keyboards. There was a similar
    TextField
    related crash in
    AlertDialog
    . I'm not sure if it has been fixed but it could be the same bug
    Zach Klippenstein (he/him) [MOD]

    Zach Klippenstein (he/him) [MOD]

    1 year ago
    That definitely looks like a bug to me, can you file an issue? The link is in the channel topic.
    jossiwolf

    jossiwolf

    1 year ago
    Heh, there's an issue for this I think
    https://issuetracker.google.com/issues/180488877 I think this is the same issue No easy workaround afaik😞
    s

    Se7eN

    1 year ago
    Yep looks the same but I'll file an issue anyway