我现在已经使用 compose 工作了几个星期,我认为有些事情仍然相当具有挑战性或很奇怪。
我的最新功能需要一个 BottomSheet,准确地说是一个
ModalBottomSheet
。
通过布局检查器进行检查时,它向我显示,ModalBottomSheet
sheetcontent
(即 surface
)会产生巨大的重组计数。 (我说的是每秒数百次):
我什至尝试清空整个
ModalBottomSheet
,所以它只是一个像这样的空壳:
val sheetState = rememberModalBottomSheetState(
initialValue = ModalBottomSheetValue.Hidden,
confirmStateChange = { it != ModalBottomSheetValue.HalfExpanded },
skipHalfExpanded = true,
)
ModalBottomSheetLayout(
sheetState = sheetState,
sheetShape = CustomTheme.shapes.bottomSheetRadius,
sheetContent = {
Column(modifier = Modifier.padding(bottom = 10.sdp)) {
}
}
) {
}
有人有同样经历吗?我找不到任何人抱怨这一点..但我认为这不行。
提前谢谢大家。
问候帕迪索