Open grandleaf opened 3 weeks ago
I guess, If you want to retain something on your screen which is in the background, use screenModel. This is compose thing: when a screen is removed from screen, it should be disposed.
@Hightower87, thanks for the suggestion. Basically I want to put a WebView into the navigation framework. And it is really expensive to recompose a WebView even though its states can somehow be saved by some unofficial approaches.
I was after the same behaviour because recomposing my main view was expensive. My work around was to do the following. I'm not sure if this is a good or best approach and would welcome feedback.
var navigator: Navigator? = null
AppTheme() {
MainScreen(onNavigate = { navigator?.push(it) })
Navigator(EmptyScreen) { nav ->
navigator = nav
SlideTransition(nav)
}
}
While I appreciate Voyager’s pragmatic interface and flexibility, I’ve encountered an issue: when navigating to a new screen, the old screen gets disposed. Is there an option to instruct Voyager to retain the old screen without destroying it? My concern arises because I’ve integrated a WebView, and disposing and recomposing screens could lead to performance degradation and state loss. Thank you.