Comments (5)
You don't need to pass viewModel
manually. It should be injected by hilt. Pass only visisDetails
parameter.
from compose-destinations.
Suppose in HomeViewModel I have data of user and I am moving from HomeScreen to Profile Screen and loading same HomeViewModel in ProfileScreen using hilt then there is no data of user. Like that HomeViewModel loads at new object with empty data. How to resolve this issue?
from compose-destinations.
You can pass user reference as an argument to AppointmentScreenDestionation
@Destination
@Composable
fun AppointmentScreen(
navigator: DestinationsNavigator,
visitDetail: VisitResponse,
user: User
) {
// rest of the logic
}
Or better retrieve user info from database or preferences.
from compose-destinations.
So it means there is no way to pass viewmodel with full data from one Composable screen to another just like we did in Fragments in older way?
from compose-destinations.
ViewModels cannot be navigation arguments, this wasn’t different with Fragments.
If you want, you can share a ViewModel by getting it on the second screen, if you know what that ViewModel is tied to (Maybe the previous back stack entry, or a nav graph back stack entry, or the activity).
from compose-destinations.
Related Issues (20)
- [Question]where to call navigate, which one is the best practices HOT 6
- KMP support HOT 4
- Bottom bar navigation documention that says to do `currentDestination == destination.direction` in selected doesn't select the element HOT 3
- [Question] How to enable / disable animation based on destination value HOT 4
- Feature request: Allow generation of SavedStateHandle from NavArgs for testing HOT 3
- Feature request: Result recipient lambda with default implementation HOT 3
- Saving history of stacks on nested navigation without multiple nav host. HOT 1
- Multiple result recipients no longer supported in 1.9.57 HOT 14
- Status of v2.0.0-alpha branch? HOT 1
- Default values in multiple lines don't work HOT 25
- Is there an equivalent of Destination.invoke for deeplinks? HOT 2
- Item selection doesn't work in Bottom Sheet HOT 9
- After updating some Gradle libraries including this one I get "BackendException: Backend Internal error: Exception during psi2ir" on a RootNavGraphDefaultAnimations implementation HOT 8
- Error: NavArgsGettersKt.dex defined mutiple times HOT 3
- Document Navigation.Extras HOT 3
- ModalBottomSheetLayout UI content no longer visible after system font size change until app restarted HOT 1
- NavArgsDelegate fails KSP due to false positive when property code comments include parentheses HOT 3
- the topbar is not displaying properly. HOT 1
- the topbar is not displaying properly.
- PopBackStack does not have a check for lifecycle state like navigate does 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.