Гость
LazyColumn внутри проблемы прокрутки ModalBottomSheetLayout
Сообщение
Гость » 09 мар 2024, 16:06
I have this below composable. when I scroll the lazycolumn, the bottomsheet closes. how to fix this? I have attached the video of the same issue below.
Код: Выделить всё
val navController = rememberNavController()
val sheetState = rememberModalBottomSheetState(
initialValue = ModalBottomSheetValue.Hidden,
skipHalfExpanded = true,
confirmValueChange = { it ->
Log.d("HomePageActivity", "SheetStateInside is $it")
false
},
)
val bottomSheetNavigator = remember { BottomSheetNavigator(sheetState) }
navController.navigatorProvider += bottomSheetNavigator
AppTheme {
ModalBottomSheetLayout(
bottomSheetNavigator = bottomSheetNavigator,
sheetShape = RoundedCornerShape(topStart = 16.dp, topEnd = 16.dp),
sheetBackgroundColor = neutral5,
) {
DestinationsNavHost(
navController = navController,
navGraph = NavGraphs.root,
startRoute = AppChooserBottomSheetDestination,
engine = rememberAnimatedNavHostEngine(),
)
}
}
My LazyColumn file
Код: Выделить всё
@Destination(style = DestinationStyleBottomSheet::class)
// @Destination
@Composable
fun AppChooserBottomSheet(
navigator: DestinationsNavigator,
) {
LazyColumn {
repeat(100) {
item {
Text(text = "App $it", style = MaterialTheme.typography.titleLarge, color = neutral100, modifier = Modifier.fillMaxWidth().padding(vertical = 8.dp))
Log.d("HomePageActivity", "SheetStateAppChooser visible is $it")
}
}
}
}
Video link: here
Same issue happens with with Column(modifier = Modifier.verticalScroll(rememberScrollState())) {
instead of LazyColumn.
Источник:
https://stackoverflow.com/questions/781 ... roll-issue
1709989590
Гость
I have this below composable. when I scroll the lazycolumn, the bottomsheet closes. how to fix this? I have attached the video of the same issue below. [code]val navController = rememberNavController() val sheetState = rememberModalBottomSheetState( initialValue = ModalBottomSheetValue.Hidden, skipHalfExpanded = true, confirmValueChange = { it -> Log.d("HomePageActivity", "SheetStateInside is $it") false }, ) val bottomSheetNavigator = remember { BottomSheetNavigator(sheetState) } navController.navigatorProvider += bottomSheetNavigator AppTheme { ModalBottomSheetLayout( bottomSheetNavigator = bottomSheetNavigator, sheetShape = RoundedCornerShape(topStart = 16.dp, topEnd = 16.dp), sheetBackgroundColor = neutral5, ) { DestinationsNavHost( navController = navController, navGraph = NavGraphs.root, startRoute = AppChooserBottomSheetDestination, engine = rememberAnimatedNavHostEngine(), ) } } [/code] My LazyColumn file [code]@Destination(style = DestinationStyleBottomSheet::class) // @Destination @Composable fun AppChooserBottomSheet( navigator: DestinationsNavigator, ) { LazyColumn { repeat(100) { item { Text(text = "App $it", style = MaterialTheme.typography.titleLarge, color = neutral100, modifier = Modifier.fillMaxWidth().padding(vertical = 8.dp)) Log.d("HomePageActivity", "SheetStateAppChooser visible is $it") } } } } [/code] Video link: here Same issue happens with with Column(modifier = Modifier.verticalScroll(rememberScrollState())) { instead of LazyColumn. Источник: [url]https://stackoverflow.com/questions/78132339/lazycolumn-inside-modalbottomsheetlayout-scroll-issue[/url]