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

Hilt integration doesn't support Screen classes #15

Closed
xinkev opened this issue Oct 7, 2021 · 6 comments
Closed

Hilt integration doesn't support Screen classes #15

xinkev opened this issue Oct 7, 2021 · 6 comments

Comments

@xinkev
Copy link

xinkev commented Oct 7, 2021

I don't if that is intentional.Hilt integration only works with AndroidScreen.
Also, docs seems incomplete... There is a sample project for that though.

@programadorthi
Copy link
Collaborator

Hi @isshindev we didn't know that Hilt works in another stack instead of Android only. Can you share what stack is your project?
The main reason that HIlt doesn't works with Screen is because Hilt needs Android context and that is provided by an AndroidScreen only. Screen was projected to work in KMM projects and Hilt doesn't works with KMM projects until now.

@xinkev
Copy link
Author

xinkev commented Oct 8, 2021

Sorry, I didn't know about that. I was only using Screen all along. Now that I think about it, it's true that hilt works with Android only. Then, documentation seems a little miss leading since Screen was used in the examples.

Here's one thing I'm really curious though. You said Android context is only provided by AndroidScreen. But we can get also get it inside any Composable functions with LocalContext.current. So, what's the different?

Thanks!

@Tolriq
Copy link

Tolriq commented Oct 13, 2021

Another side effect of this is that hilt integration does not work in TabNavigator as the Tab expands Screen and not AndroidScreen.

@xinkev
Copy link
Author

xinkev commented Oct 15, 2021

Good point! I didn't notice because I was only using empty tabs with a Navigator inside them.

@programadorthi
Copy link
Collaborator

Hi guys, there was a misunderstood here. I was thinking that we were talking about Androidx ViewModel. There is no need to Hilt and ScreenModel be exclusive to AndroidScreen really. It was a mistake because first purpose was to create an integration with Androix ViewModel.
We have fixed here #18

@adrielcafe
Copy link
Owner

Fixed on 1.0.0-beta13, feel free to reopen if the issue persists.

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

No branches or pull requests

4 participants