https://kotlinlang.org logo
Title
a

aoriani

03/24/2023, 11:38 PM
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.
Inside that launched effect, if you use repeatOnLifecycle, it should match closely
But I'm guessing a simple LaunchedEffect(Unit) is more like what you want to achieve