Joseph Hawkes-Cates
11/16/2022, 9:36 PMremember
in a few of our screens. Essentially I have multiple “Screen” level composables which store a remembered value in a val and the val has the same name in all of those composables. This results in the remembered value actually being shared across these screens as I navigate between them. Is this expected? 🧵Joseph Hawkes-Cates
11/16/2022, 9:36 PM@Composable
fun Screen1(viewModel: Screen1ViewModel) {
val isAuthenticated = remember { viewModel.isAuthenticated.value }
// ...
}
@Composable
fun Screen2(viewModel: Screen2ViewModel) {
val isAuthenticated = remember { viewModel.isAuthenticated.value }
// ...
}
These screen composables are called from the NavHost composable definitions directly based on which screen we’ve navigated to.Joseph Hawkes-Cates
11/16/2022, 9:42 PMJoseph Hawkes-Cates
11/16/2022, 9:44 PMJoseph Hawkes-Cates
11/16/2022, 9:47 PMJoseph Hawkes-Cates
11/16/2022, 9:48 PMdewildte
11/16/2022, 9:56 PMdewildte
11/16/2022, 9:58 PMJoseph Hawkes-Cates
11/16/2022, 9:58 PMJoseph Hawkes-Cates
11/16/2022, 10:00 PMJoseph Hawkes-Cates
11/16/2022, 10:02 PMJoseph Hawkes-Cates
11/16/2022, 10:03 PMdewildte
11/16/2022, 10:05 PMJoseph Hawkes-Cates
11/16/2022, 10:06 PMdewildte
11/16/2022, 10:06 PMJoseph Hawkes-Cates
11/16/2022, 10:07 PMJoseph Hawkes-Cates
11/16/2022, 10:07 PMdewildte
11/16/2022, 10:08 PMIan Lake
11/16/2022, 10:19 PMdewildte
11/16/2022, 10:19 PMIan Lake
11/16/2022, 10:20 PMNavHost
or AnimatedNavHost
? They are based on different things (Crossfade
and AnimatedContent
, respectively) and will exhibit different behavior because of that - I suspect this isn't ever possible in the laterJoseph Hawkes-Cates
11/16/2022, 10:20 PM