https://kotlinlang.org logo
#compose
Title
# compose
i

iamthevoid

05/12/2022, 8:17 AM
is it possible in compose redraw parent, but not redraw a child? For example i want single point for bottom sheet showing - and all app content must be placed inside BottomSheet content. But there can be different bottom sheets. And here i meet the need to change wrapping view (bottom sheet) without changing its content (the app) Can i do that somehow? I can just have single bottom sheet and change it layout, but it isnt looks good
How do you solve these cases?
I mean what if app content above bottom navigation, but you neet to show different modal sheets from bottom and tab bar must be overlapped by bottom sheet
j

JulianK

05/12/2022, 10:58 AM
You can just put all your child view in a Composable function and wrap that inside different parents. I guess compose will always redraw parent+child, as it is supposed to do that on structural changes.
i

iamthevoid

05/12/2022, 11:01 AM
Thanks. Tried that, but child redraw also, what is not good, because child contains navigation and it is resetting to first screen
a

Adam Powell

05/12/2022, 1:13 PM
It sounds like the word, "redraw" is being used to mean something else here. Redrawing in compose is idempotent, it does not result in state loss and therefore attempting to avoid redrawing is considered an optimization only. It sounds like you're trying to avoid recomposition of a composable function that is not idempotent; that you've written it such that it discards and recreates state when it recomposes
4 Views