Se7eN
06/02/2021, 12:52 PMLaunchedEffect
supposed to relaunch on configuration change? If yes, is there something else I can use that doesn't relaunch on config changes?Bryan Herbst
06/02/2021, 12:56 PMandroid:configChanges="[…]"
in your manifest then LaunchedEffect
should not get re-triggered.
Otherwise your entire Activity will be recreated on configuration changes so LaunchedEffect
getting re-triggered is expected.Se7eN
06/02/2021, 12:59 PMHeikki Rauhala
06/09/2021, 2:07 PMrememberSaveable
? I would like to implement an effect that would not run on back navigation.Adam Powell
06/09/2021, 2:21 PMHeikki Rauhala
06/10/2021, 5:52 AMinputs
for the saveable state and did not need to use an effect at all.androidx.compose.foundation.lazy.LazyListStateKt#rememberLazyListState
that takes inputs
and passes them to the rememberSaveable
.Se7eN
06/10/2021, 9:57 AMLaunchedEffect(isDarkTheme) {
val darkBG = (darkBackgroundFlow(context).firstOrNull() ?: false) || isDarkTheme
elementsManager.defaultTextColor = if (darkBG) onDarkBackground else onLightBackground
}
Since I'm also changing the defaultTextColor
later based on the last color selected by the user, rotating the screen resets it to the onDarkBackground
or onLightBackground
, which I didn't want. But, now that I think, passing darkBG
to my view model (where I'm creating the elementsManager
) would be a better option, right?