Comments (4)
This won't work because it Navigator is only present inside the Navigator() {}
declaration.
from voyager.
@DevSrSouza so how can I handle on BAck
from voyager.
You can create a custom BackPressureHandler for desktop.
object BackPressureHandler {
private val callbacks = mutableSetOf<OnBackPress>()
fun register(onBackPress: OnBackPress) { callbacks += onBackPress }
fun unregister(onBackPress: OnBackPress) { callbacks.remove(onBackPress) }
fun execute() { for(callback in callbacks) callback() }
}
fun interface OnBackPress {
fun onBackPressed()
}
Your code:
Window(
title = "GithubActivity",
state = rememberWindowState(width = 800.dp, height = 600.dp),
onCloseRequest = ::exitApplication,
onKeyEvent = {
if (it.key == Key.Escape){
+ BackPressureHandler.execute()
}
false
}
) {
window.minimumSize = Dimension(350, 600)
AppWithCommonTheme()
}
Navigator(
...
) { navigator ->
DisposableEffect {
val observer = OnBackPress {
navigator.pop()
}
BackPressureHandler.register(observer)
onDispose { BackPressureHandler.unregister(observer) }
}
....
}
from voyager.
Related Issues (20)
- [Question] Compose Multiplatform for Web (Wasm) HOT 1
- Why doesn't tab options support dynamic icons?
- screenModelScope crashing when used in desktop app HOT 3
- Wasm support HOT 3
- Issue collecting info share view model
- ScreenModel not available on iOS HOT 1
- [Question] Nested navigation question
- [Android] Crash Koin injected dependencies all `null` in `ScreenModel` after updating to `1.0.0` HOT 3
- Transitions crashing after v1.0.0 migration HOT 3
- Crashing with `java.lang.IllegalStateException: no event up from DESTROYED` HOT 5
- Navigation to Screen from bottom sheet HOT 2
- Navigator is getting recreated after navigation to native UIViewController in iOS HOT 11
- java.lang.IllegalArgumentException: Key screens.ScreenD:transition was used multiple times HOT 3
- multiplatform state restoration HOT 8
- ScreenModel.onDispose is not being called when exiting application HOT 1
- Linear Navigator with TabNavigator to Linear Navigator
- ScreenModel is not disposed when poped and pushed a new screen HOT 12
- How to clear all previous screen HOT 1
- Strict mode policy violation imp HOT 1
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.