Udi Oshi
01/02/2023, 1:28 PMval state = rememberModalBottomSheetState(ModalBottomSheetValue.HalfExpanded)
val scope = rememberCoroutineScope()
ModalBottomSheetLayout(
modifier = Modifier.fillMaxSize(),
sheetState = state,
sheetContent = {
Box(modifier = Modifier
.height(120.dp)
.background(color = Color.Red)) {
Text(text = "Half expanded")
}
}) {
// Full screen content
}
and keep getting:
java.lang.IllegalArgumentException: The initial value must have an associated anchor.
What am I doing wrong? 🙏Csaba Szugyiczki
01/02/2023, 1:32 PMUdi Oshi
01/02/2023, 1:33 PMCsaba Szugyiczki
01/02/2023, 1:34 PMUdi Oshi
01/02/2023, 1:38 PMUdi Oshi
01/02/2023, 1:41 PMval state = rememberModalBottomSheetState(ModalBottomSheetValue.HalfExpanded)
val scope = rememberCoroutineScope()
ModalBottomSheetLayout(
modifier = Modifier.fillMaxSize(),
sheetState = state,
sheetContent = {
Box(
modifier = Modifier
.height(120.dp)
.defaultMinSize(minHeight = 1.dp)
.background(color = Color.Red)
) {
Text(text = "Half expanded")
}
}) {
// Full screen content
Box(
modifier = Modifier
.defaultMinSize(minHeight = 1.dp)
.fillMaxSize()
) {
Text(text = "Hello content")
}
Cleanest and still crashesCsaba Szugyiczki
01/02/2023, 1:45 PMUdi Oshi
01/02/2023, 1:46 PMCsaba Szugyiczki
01/02/2023, 1:47 PMUdi Oshi
01/02/2023, 1:49 PMUdi Oshi
01/02/2023, 1:50 PMUdi Oshi
01/02/2023, 1:54 PMLaunchedEffect(key1 = state, block = {
if (state.currentValue == ModalBottomSheetValue.Hidden) {
state.animateTo(ModalBottomSheetValue.HalfExpanded)
}
})
crashes it with same exception
🙅Csaba Szugyiczki
01/02/2023, 1:57 PMUdi Oshi
01/02/2023, 1:58 PMUdi Oshi
01/02/2023, 1:59 PMLaunchedEffect(key1 = state, block = {
if (state.currentValue == ModalBottomSheetValue.Hidden) {
scope.launch {
delay(2500)
state.animateTo(ModalBottomSheetValue.HalfExpanded)
}
}
})
same result. How many workarounds we need to use in order to show this component? 😂Csaba Szugyiczki
01/02/2023, 2:07 PMUdi Oshi
01/02/2023, 2:17 PMjossiwolf
01/03/2023, 7:38 AMCsaba Szugyiczki
01/03/2023, 8:05 AMjossiwolf
01/03/2023, 8:28 AMCsaba Szugyiczki
01/03/2023, 8:29 AMjossiwolf
01/03/2023, 8:36 AMUdi Oshi
01/03/2023, 8:52 AM