Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a way to get a reference to the currently showing modal page instance. #727

Closed
NathanaelA opened this issue Sep 13, 2015 · 9 comments
Milestone

Comments

@NathanaelA
Copy link
Contributor

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?

@N3ll
Copy link
Contributor

N3ll commented 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

This comment was marked as abuse.

@N3ll
Copy link
Contributor

N3ll commented 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

This comment was marked as abuse.

@N3ll N3ll added this to the 1.5 (Under Review) milestone Oct 12, 2015
@hamorphis
Copy link
Contributor

OK. I will try to implement a frame.getModal() method.

@hamorphis
Copy link
Contributor

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;

@hamorphis hamorphis 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. Oct 21, 2015
@hamorphis
Copy link
Contributor

var label = frame.topmost().currentPage.modal.getViewById("label");

hamorphis added a commit that referenced this issue Oct 21, 2015
Fixed #727:  Provide a way to get a reference to the currently showin…
@erkanarslan
Copy link

@hamorphis This seems to be not working anymore. currentPage has no modal on it.

@lock
Copy link

lock bot commented 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.

@lock lock bot locked and limited conversation to collaborators Feb 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants