what would be the equivalent of "onResume" for a "screen" when using the navigation component ? A LaunchedEffect? . I wanna reset the scroll every time user returns to the screen
z
Zaki Shaikh
03/25/2023, 4:46 AM
Yes, You can do it in
LaunchedEffect
passing
key1 = Unit
. Whenever you returns to the screen it will execute whatever you put in it.
y
yschimke
03/25/2023, 5:18 AM
Depends whether you actually want the exact behaviour. Those are not exactly the same.
yschimke
03/25/2023, 5:21 AM
Inside that launched effect, if you use repeatOnLifecycle, it should match closely
yschimke
03/25/2023, 5:22 AM
But I'm guessing a simple LaunchedEffect(Unit) is more like what you want to achieve