Comments (2)
you can achieve it with callbacks easily (kotlin callbacks)
assume below function is in your ScreenModel
suspend fun loginUser(result:(data: UserResponse?, error: String?) -> Unit){
repository.loginUser(model){response, error ->
response?.let {
result(it, null)
}
error?.let {
Log.i("error", "loginUser Error: $it")
result(null, it)
}
}
}
you can call it in your screen like below
screenModel.loginUser{data, error ->
response?.let{
//navigate another screen in here
}
}
from voyager.
There are two main approaches that I know:
- With UiState - set some flag that indicates you need to navigate somewhere, then consume it by unsetting it
screenmodel.navigetedToSomeScreen()
. - With one time effects - use some kind of Channel that exposes events as Flow
from voyager.
Related Issues (20)
- 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 HOT 3
- 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 15
- java.lang.IllegalArgumentException: Key xxx:transition was used multiple times on kotlin 2.0.0-RC2 & r8 HOT 3
- voyager-koin causes build error for iOS Simulator HOT 2
- What is the right way to have different Windowinsets for every screen HOT 2
- Dispatchers.Main in androidUnitTest kmm HOT 4
- Crashing in bottom navigation
- Nested Screen in Bottom Navigation
- Voyager 1.1.0-beta01 issues HOT 5
- navigator will close automatically HOT 3
- CompositionLocal LocalLifecycleOwner not present HOT 2
- Compose multiplatform build failed HOT 2
- Popping navigator in background doesn't work
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.