dimsuz
02/08/2022, 1:54 PMLocalConfiguration.current
present in the Compose's resources()
. Does it have the effect of recomposing when Configuration
changes?
@Composable
@ReadOnlyComposable
private fun resources(): Resources {
LocalConfiguration.current
return LocalContext.current.resources
}
sindrenm
02/08/2022, 2:03 PMLocalConfiguration.current
changes. 👍Andrew Neal
02/08/2022, 2:31 PMdimsuz
02/08/2022, 2:39 PMArjun Achatz
02/08/2022, 5:34 PMdimsuz
02/08/2022, 5:35 PMZach Klippenstein (he/him) [MOD]
02/09/2022, 8:00 PMresources
can change out from under us whenever a config change happens, but the Context
itself doesn’t change, so we have to explicitly observe the configuration object to know when the resources might have changed.Oh jeez.. this is gonna make reading compose code a bit more difficultIt shouldn’t – this implementation detail is to ensure that callers of this
resources()
function are restarted whenever the resources might have changed, which is standard behavior for composable functions – they restart when state they consume is changed.