← Winnitude! Search  ·  Reader Mode (2335 ms)
Links: Stay in Reader Retro Site Converter Retro Mode: OFF Original Page ↗
GITHUB · 53 LINKS

Created a new event to allow blocking of navigation. by NathanaelA · Pull Request #618 · NativeScript/NativeScript

Repository navigation

Created a new event to allow blocking of navigation. - #618


Closed
NathanaelA wants to merge 1 commit into NativeScript:master from NathanaelA:onCanNavigateFrom
Closed

Created a new event to allow blocking of navigation. #618 NathanaelA wants to merge 1 commit into NativeScript:master from NathanaelA:onCanNavigateFrom

Conversation

NathanaelA commented Aug 23, 2015



Copy link Copy Markdown
Contributor

This creates an event that gets ran before navigation is even tried. This allows a page to cancel navigating from a page. Fix for #583

Example:
Page.on('canNavigateFrom', function(args) { args.canNavigate = false; });

Created a new event to allow blocking of navigation. 8075009

ns-bot commented Aug 23, 2015



Copy link Copy Markdown

Can one of the admins verify this patch?

This comment was marked as abuse.

Sign in to view ns-bot added cla: yes and removed cla: no labels Aug 23, 2015

atanasovg commented Aug 28, 2015



Copy link Copy Markdown
Contributor

Hey @NathanaelA , thanks a bunch for your contribution. We discussed your pull internally and our suggestion is to use the existing onNavigatingFrom event rather than creating a new event. The event data may be extended with a new cancel property, which, if set to true, will prevent the page from being navigated from.

A similar implementation may be found in the application module for android - as stated in the definition file .

Additionally, my thinking is that it is a better idea to add a more general approach to canceling back/forward navigation. Because it is the ui/frame module that manages the navigation, it seems naturally to me to extend the Frame class with, for example, a previewNavigation event, which will provide the following data:

interface PreviewNavigationData {
    entry: NavigationEntry,
    isBackNavigation: boolean
    cancel: boolean
}

What do you think?

This comment was marked as abuse.

Sign in to view

dtopuzov commented Sep 3, 2015



Copy link Copy Markdown
Contributor

run ci

ns-bot commented Sep 3, 2015



Copy link Copy Markdown

✅

enchev commented Oct 1, 2015



Copy link Copy Markdown
Contributor

Hey @NathanaelA , @atanasovg , @hshristov ,

What the status of this pull request? Is it still valid or the requested functionality is already available?

Thanks!

atanasovg commented Oct 1, 2015



Copy link Copy Markdown
Contributor

Well, as I already stated in my previous comment, our suggestion is to not introduce new event but rather use the existing onNavigatingFrom. Still, @NathanaelA has a valid point where the proposed approach requires significantly more work (and low-level navigation changes) to be implemented. So, probably we will need to plan this issue and implement it internally.

enchev commented Oct 1, 2015



Copy link Copy Markdown
Contributor

@atanasovg In this case should we close this pull request and open issue? @NathanaelA what do you think?

Thanks

This comment was marked as abuse.

Sign in to view

enchev commented Oct 8, 2015



Copy link Copy Markdown
Contributor

Ok, in this case let's close this and open an issue describing in details the problem with onNavigatingFrom event and what needs to be refactored.

enchev closed this Oct 8, 2015 enchev mentioned this pull request May 25, 2016 Navigation/Routing issues #2170 Closed 5 tasks

lock
Bot
commented Aug 29, 2019



Copy link Copy Markdown

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock
Bot
locked and limited conversation to collaborators Aug 29, 2019 Sign up for free to subscribe to this conversation on GitHub . Already have an account? Sign in .

Labels

cla: yes

5 participants