Comments (3)
Ksp task runs in each module separately and so it doesnโt know about classes in other modules.
This is for now expected and you do have to use the Open approach. I would like to know why does it make things very complicated, can you give me more info about that?
When manually calling your screen, you should be in a position where you can easily prepare the same dependencies you were in dependencyContainerBuilder, right?
Iโll keep this open though maybe I have an idea about how I could improve this for v2.
from compose-destinations.
Ok so the recepient screen looks like this
fun RecepientScreen(
viewModel: RecepientViewModel,
resultRecipient: OpenResultRecipient<CustomType>
) {
}
that view model gets injected through your library using dependenciesContainerBuilder. We do this because we are sharing that VM between 2 screens and we want it to stay alive and shared between those 2 screens.
in the Destinations nav host if I try to manual create the screen then I have to manually pass in the view model and I'm not sure how to do that while maintaining that shared view model functionality
DestinationsNavHost(
dependenciesContainerBuilder = { CreateRecepientScreenVM() }
) {
composable(RecepientScreenDestination) {
RecepientScreen(
viewModel = / what goes here? /,
resultRecipient = resultRecipient<ResultProducerScreenDestination, ResultType>())
}
}
CreateRecepientScreenVM() is an extension function we created to create the viewModel but it only can be called in the context of dependenciesContainerBuilder
from compose-destinations.
Sorry for delay in response here ๐
There is no reason why CreateRecepientScreenVM() should be able to be called in one place but not the other. Both have similar receivers in the lambda (Some kind of DestinationScope).
Try having the CreateRecepientScreenVM
be an extension function of DestinationScopeWithNoDependencies
. Then you should be able to call it on both manual calls and dependency builders cases ๐
Hope this helps!
from compose-destinations.
Related Issues (20)
- How to Build NavGraphs with Dynamic Modules? HOT 4
- Making bottomSheet stay above bottom bar HOT 3
- how to pass parameters to the startRoute HOT 1
- how to use NavigationBar with composedestinations HOT 2
- disable default animation when using animations-core HOT 3
- Navigation not working within the NavResult HOT 1
- Navigating to different graph from NavigationBar, is there a clean way for a full screen? HOT 2
- Deleted Destination is still being generated HOT 1
- Problem when upgrading to Kotlin 1.9.0 HOT 3
- Can't Generate NavGraphs
- Generated argsFrom() function can find only parameters that are of String type HOT 9
- Multi-modular usage of library, documentation lacking information HOT 3
- navController.navigate not working when upgrade to androidx.navigation:navigation-compose:2.7.1 HOT 3
- issue in generated Destination class HOT 8
- Dialog and Bottomsheet Scrims Missing in 1.9.51 HOT 1
- Crash - IllegalStateException: LayoutNode should be attached to an owner HOT 3
- How to add an attribute to Destinations to indicate whether they should include the bottom bar for example HOT 4
- appCurrentDestinationAsState alternative for multi-module apps HOT 1
- Crash: Cannot call NavBackStackEntry.route() before DestinationsNavHost! HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from compose-destinations.