Git Product home page Git Product logo

tinynavigationhelper's People

Contributors

dhindrik avatar johankson avatar sthewissen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

tinynavigationhelper's Issues

Typed navigation parameters?

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:

  • Type safety

CONS:

  • Might be hard to implement cleanly

ViewModel Navigation for All Platforms

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.

Unable to navigate from a Modal page

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");

NavigateTo<T>

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>();

Modal Page issue

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.
Example

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?

Optionally allow disabling of animation

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?

Why aren't navigation Async?

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.