Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
To Reproduce There are about two hundred pictures in the LazyVerticalStaggeredGrid, which will cause lag when sliding quickly. its my code
@Composable private fun ImageSelect(mediaList: List<MediaSelectBean>) { LazyVerticalStaggeredGrid(columns = StaggeredGridCells.Fixed(3), modifier = Modifier.padding(horizontal = 6.dp)) { mediaList.forEachIndexed { index, mediaSelectBean -> item(key = index) { MediaItem(mediaSelectBean) } } } } @Preview @Composable private fun MediaItem(mediaSelectBean: MediaSelectBean? = null) { val aspectRatio = (mediaSelectBean?.width ?: 1).coerceAtLeast(1) / (mediaSelectBean?.height ?: 1).coerceAtLeast(1).toFloat() Surface( color = Color.LightGray, modifier = Modifier .fillMaxWidth() .aspectRatio(aspectRatio) .padding(8.dp), shape = RoundedCornerShape(6.dp) ) { AsyncImage( model = ImageRequest.Builder(LocalContext.current) .data(mediaSelectBean?.mediaPath) .crossfade(true) .build(), contentDescription = null, contentScale = ContentScale.Crop, modifier = Modifier.fillMaxSize() ) } }
Logs/Screenshots https://github.com/coil-kt/coil/assets/44636532/03eba39b-c0bc-443f-a401-73ed6f3124d5
Version coilComposeVersion = "2.5.0" ,Mobile phone model Xiaomi 5s, Android version 11
The text was updated successfully, but these errors were encountered:
By "it gets stuck" do you mean it drops frames? Can you try reducing this setting to 3 or 2 and see if that helps?
Going to close this out and track Compose perf issues under this issue: #1866
To Reproduce
There are about two hundred pictures in the LazyVerticalStaggeredGrid, which will cause lag when sliding quickly.
its my code
Logs/Screenshots
https://github.com/coil-kt/coil/assets/44636532/03eba39b-c0bc-443f-a401-73ed6f3124d5
Version
coilComposeVersion = "2.5.0" ,Mobile phone model Xiaomi 5s, Android version 11
The text was updated successfully, but these errors were encountered: