Simon Hardt
03/31/2023, 1:38 PMWindowInsets.navigationBars.getBottom(LocalDensity.current)
nor the navigationBarsPadding()
-modifier.
This occurs when I have composable inside a ComposeView
which itself is inside an AndroidView
. Maybe this double injection screws up the insets? This is used as a way to show a Fragment
inside an Activity
which only uses ComponentActivity.setContent()
to get into compose and everything else is handled inside compose only (e.g. navigating to different screens and some of those are simple composables but some are legacy fragments)Stylianos Gakis
03/31/2023, 2:37 PMcompose -> fragment -> compose
so by doing
compose -> Get insets here -> fragment -> compose
Do you get the right insets? If I were you I’d try to do a minimal repro of this, to see that it’s not me breaking this somehow, or if it’s that this doesn’t work at all anyway.
Sorry for pinging you @Alex Vanyo but if there’s someone who might know if this should work normally I think it would be you, so would be great if you could help out here 😊shikasd
03/31/2023, 6:04 PMAlex Vanyo
03/31/2023, 6:09 PMComposeView.consumeWindowInsets
to false
for your outermost ComposeView
, to allow inset information to propagate to contained views:
https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/ComposeView#(androidx.compose.ui.platfor[…]seView).consumeWindowInsets()
There’s also a known limitation for consumption on the Compose side given by https://issuetracker.google.com/issues/243778587.
I’m not sure if setParentCompositionContext
covers modifier locals that insets use?shikasd
03/31/2023, 6:10 PMSimon Hardt
04/03/2023, 7:10 AMAndroidView
if it doesn't 🙂andylamax
04/03/2023, 9:54 AM