adrielcafe / voyager

🛸 A pragmatic navigation library for Jetpack Compose
https://voyager.adriel.cafe
MIT License
2.27k stars 109 forks source link

Cant pass a lambda to a Screen #374

Closed YoussefHachicha closed 1 month ago

YoussefHachicha commented 1 month ago

when ever i pass a non serilizable object to a screen if i leave the app in the background and open it again it will crash for example i passed this lambda here class HomeNav( private val onThemeChange: (QuranTheme) -> Unit, ) : Screen {

any idea on how can i be able to change the theme without passing a lambda ?

DevSrSouza commented 1 month ago

Voyager screens act as State, all screen should be able to be restored, lambdas are no allowed. https://voyager.adriel.cafe/state-restoration

I will close this issue as not planned. Design decisions on how to find a way to do onThemeChange you will need to go deeper in details and I suggest go to Discussions

YoussefHachicha commented 1 month ago

thanks but do you have any idea on how can i pass that?