Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: hilt works with screen instead of android screen #18

Merged
merged 4 commits into from
Oct 18, 2021

Conversation

programadorthi
Copy link
Collaborator

@programadorthi programadorthi commented Oct 16, 2021

Some people are using Screen in your android projects with Hilt. Until now voyager is not KMM. So this pull request add support to use Hilt with Screen instead of AndroidScreen. Issues #15 and #17

WARNING: When using Screen in an Android project and you needs a instance of ViewModel the ViewModelStore will be the default provided by your current Activity. So your ViewModel onCleared will be called when Activity is totally destroyed only.

Our recomendations is to use AndroidScreen because it provides a custom ViewModelStore. So if you pop a screen its ViewModel onCleared will be called on pop action instead of wait activity is totally destroyed.

Another fix was changing multibindings to be optional required by #16.

added: back support to activity viewmodel store when using not android lifecycle provider
@adrielcafe adrielcafe merged commit 3b99a78 into main Oct 18, 2021
@adrielcafe adrielcafe deleted the fix/hilt-work-with-screen branch October 18, 2021 23:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants