`WindowInsets.navigationBars.getBottom(LocalDensit...
# compose
z
WindowInsets.navigationBars.getBottom(LocalDensity.current)
always returns 0, then the actual value; is this by design, or a bug?
1
j
Where do you read it?
z
I can just put this code in setContent and see the same behavior! Saw it first when using it "outside" a
ModalBottomSheet
(to be used in the sheets contents).
i
Is your screen actually edge to edge (for example, does it use the Activity 1.8.0 API of
enableEdgeToEdge
)? By default, Android insets you automatically so you don't have any insets to handle unless you go edge to edge
z
Yup, I'm using edge to edge!
a
Sort of by design, as a limitation of the framework: https://developer.android.com/jetpack/compose/layouts/insets#insets-and-phases Composition is slightly too early for retrieving the actual insets values, since it is before the real inset values are known, which is corrected on the next composition. If you read the inset values in layout and measure, then you should get the correct value on the same frame that it is updated.
1
z
Awesome, then I wont look further into it! I was having an issue where my insets were seemingly ignored and I couldnt tell why; I was adjusting them with additional paddings, and so remembering the combined values .. so I never got the second, "real" value.
103 Views