Comments (2)
Thank you for the request for API improvements, such requests are very valuable. I have considered the concern and decided to keep this API as it is.
Rationale: the back button handling is applicable not only for Android, but for other platform as well. E.g. there are TVs, watches, kiosks with hardware buttons, embedded devices, etc. I understand that this feature is rarely used outside of Android, but still there are possible cases.
Here is additional background. BackPressedDispatcher
is already moved to the separate back-pressed
module of the Essenty library. The main decompose
module depends as api
on the back-pressed
module.
Why decompose
depends on back-pressed
? Because the Router
controls child component's BackPressedHandler
s. Without this dependency, clients will have to pass BackPressedHandler
manually via constructors. And what is more important, they will have to manage child BackPressedHandler
s manually. When a child component is destroyed, all references to its personal BackPressedHandler
should be released, to avoid memory leaks.
Why back-pressed
is api
dependency? BackPressedHandler
is part of the public API, e.g. it is exposed from ComponentContext
as a property. So this dependency is for convenience, for clients to use the public API smoothly.
from decompose.
Thanks for the detailed answer!
from decompose.
Related Issues (20)
- Add Compose previews to all samples
- Describe routing options in the docs HOT 3
- Add `Navigator.navigateSingleTop` extension function HOT 3
- Setup publication checks
- Calling `backPressedDispatcher.onBackPressed()` from a child component does not trigger back action
- [extensions-compose] Сonsequences of rememberSaveable HOT 20
- Consider renaming Configuration to Key HOT 1
- Dead links in the readme HOT 1
- UIKit support HOT 9
- Support new Apple silicon targets
- Dynamic list of active child components HOT 1
- Navigator.bringToFront() not available in 0.3.1 HOT 4
- Enable watchos target for the Counter sample after Kotlin 1.5.31 update HOT 2
- Add simplest code examples to the main Overview docs section
- Nullable Value/MutableValue HOT 3
- Broken link in docs HOT 2
- Failure to render screen after installation HOT 5
- Web Browser routing support HOT 2
- is this support multi window in desktop? 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 decompose.