Comments (2)
The navigation relies on state changes to work, you don't have to be inside a composition. So, you can create an instance of your ViewModel/UseCase inside the composition and pass the navigator instance to it.
Example with Koin:
val navigator = LocalNavigator.currentOrThrow
val viewModel = getViewModel<MyViewModel>(navigator)
Since we can have nested navigators (thanks to CompositionLocals) I don't see a way to get the navigator instance outside the composition.
from voyager.
Thanks
from voyager.
Related Issues (20)
- how can I change BottomSheetNavigator background in Screen? HOT 1
- Navigation from ScreeModel HOT 2
- [Bug][Deeplink] Navigator stack doesn't change after screens list changes
- How to set the actionbar functionalities using the TabNavigation?
- TabDisposable with nested/parent navigation loses Screen state
- Recomposition issue when using nested Navigators and MaterialKolor HOT 5
- Using Voyager-Koin with wasm in Kotlin Multiplatform HOT 1
- Layout Inspector and Live Edit are not working HOT 1
- Screens are not cleared when calling navigator.replaceAll HOT 4
- Tab recreate
- Retain old screen HOT 3
- Nested navigators inside Tabs don't get disposed when the TabNavigator gets disposed.
- push Screen Crash with Double BottomSheetNavigator and Transition
- Screen as popup or transparent packground HOT 2
- remember loses state after navigation HOT 9
- Koin-Integration: getting scoped ScreenModel
- Support for Shared Element Transition
- Make it possible to pass Scaffold PaddingValues to CurrentTab() HOT 3
- RegisterScreen:transition was used multiple times HOT 8
- java.lang.IllegalArgumentException: Key xxx:transition was used multiple times on kotlin 2.0.0-RC2 & r8 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 voyager.