tinystuff / tinynavigationhelper Goto Github PK
View Code? Open in Web Editor NEWTinyNavigationHelper is a library that is created for you that want to abstract the navigation without installing a bigger MVVM framework.
License: MIT License
TinyNavigationHelper is a library that is created for you that want to abstract the navigation without installing a bigger MVVM framework.
License: MIT License
This is a bit of a long shot, but could we create typed navigation parameters?
// Definition
Task NavigateToAsync<TView, TArgument>(TView view, TArgument argument);
// Usage (argument is deferred by usage)
await Navigation.NavigateToAsync<ListEditorView>(shoppingList);
This means the view model must accept a specific set of parameters using generics as well.
public class MyViewModel<ShoppingList> : ViewModelBase<TArgument>
{
public async override Task Initialize()
{
var parameter = NavigationParameter; // of the type ShoppingList (null or set to a reference of an object)
}
}
PROS:
CONS:
When calling
await Navigation.NavigateToAsync("UnknownView", parameter);
there is no notification of any kind if the view doesn't exist?
Hey guys needed Some help with Tiny Navigation library . I need to use the same in an application which has to support multiple platforms like Xamarin.Mac and Windows WPF apart from regular iOS, Android and UWP . Do you have a sample where you have done ViewModel Navigation targeting all these frameworks alongwith the Xamarin.Forms project.
In NavigateToAsync, when private field _modalNavigationPage is not null, the execution end up in an empty else-block instead of navigating to the requested page.
This happends if we first open a modal:
NavigationHelper.Current.OpenModalAsync("SomeView", withNavigation: true);
And then try to navigate from "SomeView" to "SomeView2"
NavigationHelper.Current.NavigateToAsync("SomeView2");
Can we add support for navigating to a type directly. Most of the time you only register one view of a specific type.
NavigationHelper.NavigateTo<AboutView>();
If you use _navigationHelper.OpenModalAsync(someview, true)
then if you somehow close the modal page without _navigationHelper.CloseModalAsync()
method then the NavigateToAsync
on mainpage won't be possible, because the private NavigationPage? _modalNavigationPage
in FormsNavigationHelper
is not null.
As you can see on example below I navigated back using the android back button. which caused this. This also means if you use NavigationHelper OpenModal method with withNavigation parameter you are forced to close the modal only using the NavigationHelper CloseModal method, otherwise your navigation will get broken.
Ideas:
1.Provide additional parameter in NavigateToAsync that will set internally _modalNavigationPage
to null.
2.Somehow to check in modal navigation stack if modalNavigationPage doesn't exist anymore we skip it?
For performance reasons, we want to disable animation on navigating.
Anywhere in "FormsNavigationHelper" that has ".Navigation.PushAsync(page)", we should allow optionally passing a boolean, E.g. to disable navigation it would be ".Navigation.PushAsync(page, false)" (the default is true if not supplied). Same goes for "PushModalAsync", "PopAsync" and "PopModalAsync".
In terms of how to configure it, maybe there could be a base class for pages that has the boolean, then on each page it can set whether to navigate on entering/leaving? Or is there a better place to configure it?
Deep down in the FormsNavigationHelper there is a line that looks like this
_app.MainPage.Navigation.PushAsync(page);
This is a bad practice since exceptions will not be handled correctly.
Why don't we async all the methods?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.