Created
December 21, 2022 09:48
-
-
Save muankit/39912ffb5251ed009ecbc8e2fcc62614 to your computer and use it in GitHub Desktop.
Composition Local Provide is not updating child compose if provider value changed at runtime
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun ScreenUI() { | |
val isRtl = if (viewModel.isRtl) { | |
LocalLayoutDirection provides LayoutDirection.Rtl | |
} else { | |
LocalLayoutDirection provides LayoutDirection.Ltr | |
} | |
CompositionLocalProvider(isRtl) { | |
ConstraintLayout(modifier = Modifier.fillMaxSize()) { | |
// Other compose code | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment