Closed xinkev closed 3 years ago
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.
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!
Another side effect of this is that hilt integration does not work in TabNavigator as the Tab expands Screen and not AndroidScreen.
Good point! I didn't notice because I was only using empty tabs with a Navigator inside them.
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
Fixed on 1.0.0-beta13, feel free to reopen if the issue persists.
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.