Giter Site home page Giter Site logo

Comments (13)

vjoao avatar vjoao commented on May 22, 2024 7

Would be cool if NS core exposed some sort of routing abstraction for external frameworks to take advantage of.

from nativescript-vue.

rigor789 avatar rigor789 commented on May 22, 2024 4

The previous is now implemented, the code needs some cleaning up and refactoring, but for the most part it works on both android and iOS.

On iOS however, there is a bug: if you go back, and try to go to the same route again, nothing happens.

I am pretty sure this is because the back button is navigating back natively, and the routers state is still on the previous route.

from nativescript-vue.

rigor789 avatar rigor789 commented on May 22, 2024 2

This should be fully functional in 0.3.0 along with custom transitions #68

from nativescript-vue.

rigor789 avatar rigor789 commented on May 22, 2024 1

VueRouter works out of the box, without any changes! However that's only for "navigating" on a single page. To add support for multiple pages (different activities) it requires some extra work.

from nativescript-vue.

jlooper avatar jlooper commented on May 22, 2024 1

When you say 'multiple pages' what do you mean? I got the router using @tap="$router.push({ name:'recipe',params: {id: recipe.id} })" - following your router example. Works ok!

from nativescript-vue.

rigor789 avatar rigor789 commented on May 22, 2024

Related to #18 since it would use that internally

from nativescript-vue.

rigor789 avatar rigor789 commented on May 22, 2024

What I mean by pages is that it should allow for navigating to "brand new" instances of a Page, instead of removing all child elements of a single page, and repopulating it with the contents of the new page.

Similar to what ns-angular does https://docs.nativescript.org/angular/core-concepts/angular-navigation.html#pages

router-outlet which is the current behavior with VueRouter inside nativescript-vue

and page-router-outlet which is the proposed feature!

from nativescript-vue.

jlooper avatar jlooper commented on May 22, 2024

How do we handle the special needs of mobile routing, like handling the back button? When I use a back button on my android emulator to 'go back' - my app crashes on the emulator. Wondering if we have to use a strategy like we do in Angular, using RouterExtensions? - an enhanced mobile-friendly router?

from nativescript-vue.

rigor789 avatar rigor789 commented on May 22, 2024

Update: Quite a bit of progress has been made today, mostly rewriting the older (hacky) implementation with a better solution.

Right now the <modal-page> component is a functional (stateless) component that registers the router hooks, and handles the back button event.

I am thinking of making this component do much less and extract the logic to the router-plugin.js.

The idea is that if the modal-page component is added to the root component, it simply toggles an option on the root instance, which makes the router use pages. This would serve as syntactic sugar, when you look at the component and see a <router-page> it tells what is going on...

This would be completely optional, and the option could be toggled manually, something like:

new Vue({
  pageRouting: true
}).$start()

from nativescript-vue.

koddr avatar koddr commented on May 22, 2024

@rigor789 Do you found any solutions for iOS back button bug? It's make me sad, because refactoring and testing app now is very difficult. Would be nice to disable this native option.

from nativescript-vue.

rigor789 avatar rigor789 commented on May 22, 2024

@koddr I haven't had time to look into it, but it is high up on my todo list!

from nativescript-vue.

koddr avatar koddr commented on May 22, 2024

@rigor789 Nice to listen 👍 keep watching and support project anyway.

from nativescript-vue.

rigor789 avatar rigor789 commented on May 22, 2024

@koddr I pushed some changes to the page routing, can you give it a shot? I tested it on iOS and Android and both seem to work as expected!

from nativescript-vue.

Related Issues (20)

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.