Skip to content

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

Closed

Description

@NathanaelA

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?

Activity

  1. N3ll commented on Oct 8, 2015

    @N3ll
    Contributor

    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.

  2. NathanaelA commented on Oct 8, 2015

    @NathanaelA
    Author
  3. N3ll commented on Oct 9, 2015

    @N3ll
    Contributor

    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? :)

  4. NathanaelA commented on Oct 9, 2015

    @NathanaelA
    Author
  5. added this to the milestone on Oct 12, 2015
  6. hamorphis commented on Oct 20, 2015

    @hamorphis
    Contributor

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

  7. self-assigned this
    on Oct 20, 2015
  8. hamorphis commented on Oct 21, 2015

    @hamorphis
    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;

  9. 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
  10. hamorphis commented on Oct 21, 2015

    @hamorphis
    Contributor

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

  11. added a commit that references this issue on Oct 21, 2015
    8dc0e81
  12. added a commit that references this issue on Oct 21, 2015
    497dc23
  13. erkanarslan commented on Feb 19, 2019

    @erkanarslan

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

  14. lock commented on Feb 21, 2020

    @lock

    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.

  15. locked and limited conversation to collaborators on Feb 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions