You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Provide a way to get a reference to the currently showing modal page instance. #727
There does not seem to be an equivalent way to get the current modal view that is running like you can get the current non-modal page from the frame.topmost(). With the frame.topmost() you can do view.getViewById(frame.topmost(), "id") and find an id somewhere on the running non-modal page.
However, if a modal page is up; it is not included in the search. Is their another technique other than capturing the modal page object on the loaded event? (i.e. so if I have a library that auto-searches for something it can find it if it is a normal page or a modal page).
Did I miss something, or does the frame code need some addition code to allow the modal pages to be included in a modal stack so that the search can find it?
Hey, @NathanaelA , we misunderstood you question - sorry about that! The modal page cannot be accessed like that and it has nothing to do with the frame.topmost(), because it is not part of the navigation stack. Can you give us some more information about you are trying to achieve, so we can be more of a help? :)
Since a modal page always has a parent page, I decided to add a new property to the Page class called "modal". Getting it will return the currently shown modal page if any. So you could get it like this:
var modalPage = frame.topmost().currentPage.modal;
changed the title [-]view.getViewById/frame.topmost does not work properly on modal pages[/-][+]Provide a way to get a reference to the currently showing modal page instance.[/+]on Oct 21, 2015
Activity
N3ll commentedon Oct 8, 2015
Hey @NathanaelA , you will have to use the instance method https://github.com/NativeScript/NativeScript/blob/master/ui/core/view.d.ts#L393 instead of the static one.
NathanaelA commentedon Oct 8, 2015
N3ll commentedon Oct 9, 2015
Hey, @NathanaelA , we misunderstood you question - sorry about that! The modal page cannot be accessed like that and it has nothing to do with the frame.topmost(), because it is not part of the navigation stack. Can you give us some more information about you are trying to achieve, so we can be more of a help? :)
NathanaelA commentedon Oct 9, 2015
hamorphis commentedon Oct 20, 2015
OK. I will try to implement a frame.getModal() method.
hamorphis commentedon Oct 21, 2015
Since a modal page always has a parent page, I decided to add a new property to the Page class called "modal". Getting it will return the currently shown modal page if any. So you could get it like this:
var modalPage = frame.topmost().currentPage.modal;[-]view.getViewById/frame.topmost does not work properly on modal pages[/-][+]Provide a way to get a reference to the currently showing modal page instance.[/+]hamorphis commentedon Oct 21, 2015
var label = frame.topmost().currentPage.modal.getViewById("label");Fixed #727: Provide a way to get a reference to the currently showing…
Merge pull request #968 from NativeScript/issue-727
erkanarslan commentedon Feb 19, 2019
@hamorphis This seems to be not working anymore. currentPage has no modal on it.
lock commentedon Feb 21, 2020
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.