Comments (6)
@chRyNaN I just want this library to meet my needs, which are
- The API is very easy to use like google's compose navigation library for android
- Currently The API is not complex, I don't have a complex navigation system anyway, simple account management user interface navigation is what I required, The library really fits my needs, I moved away from decompose navigation because it was complex to use, I definitely want this library to not be complex and remain easy to use.
- The API allows me to do all sorts of operations
- Stack API is not complete yet,
replace
,replaceAll
as seen here https://github.com/adrielcafe/voyager#samples
- Stack API is not complete yet,
- The library is fast & small
I don't use NavigationContext, only had to use for this issue, can't say the same for other people, I also don't really know how Tree data structure would impact this navigation library, I am perfectly fine with Stack navigation API as long as it allows all sorts of operations. For nested navigation I am also perfectly fine creating another navigator. Its your call whether tree data structure should be used or not.
from navigation.
@wakaztahir Yes, a simple, easy to use API is one of the main goals of this library. And that is why I am considering removing the NavigationContext
concept altogether as it seems to bring confusion and complexity.
from navigation.
@chRyNaN There's no way to replaceAll
with a single
from navigation.
@chRyNaN For now I have resolved the issue by creating a enum class that implements NavigationContext
starting with different initial destination, I don't really need multiple contexts, I just need a way to replace the current destination, having a way to replace current context would also be great if that could be done
from navigation.
@wakaztahir Thanks for bringing up the issue. A few things here:
- You do not need to use the
SingleNavigationContext
constructor. The logic for that is encapsulated within the library. When creating aNavigator
, if you do not explicitly provide aninitialContext
, then it uses theSingleNavigationContext
. - Currently, the operations are that of a basic Stack: push/pop. There's no elegant solution yet for what you are trying to do unfortunately. You could continuously call the
popDestination
function until you reach the bottom of the stack and thenpush
the new destination. But obviously this is not ideal.
I will try and add this feature in an upcoming release. Unfortunately, I don't have the time to immediately work on this. I'll keep this issue alive until it is implemented. Also, I'm considering moving from a Stack to a Tree approach and removing the NavigationContext
concept. Thoughts on that are appreciated.
from navigation.
This code snippet causes infinite loop
while(navigator.canPopContext()){
navigator.popContext()
}
I have these functions currently
@OptIn(ExperimentalNavigationApi::class)
fun <D : NavigationDestination,C : NavigationContext<D>> Navigator<D, C>.replaceAllDestinations(destination : D) {
while(canPopDestination()) {
popDestination()
}
push(destination)
}
@OptIn(ExperimentalNavigationApi::class)
fun <D : NavigationDestination,C : NavigationContext<D>> Navigator<D, C>.replaceContext(context : C) {
popContext()
push(context)
}
from navigation.
Related Issues (8)
- Proposing a minimum version of Android set to 23 HOT 1
- MinSdk to 21 HOT 5
- Document Nested Navigation HOT 2
- Overload resolution ambiguity for goTo function HOT 2
- New API in latest version HOT 3
- CRITICAL BUG using java.time.Instant which is not available in API below 26 HOT 6
- crash on rememberSavableNavigator HOT 2
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 navigation.