triniwiz / nativescript-popup

Apache License 2.0
22 stars 17 forks source link

Opening modal after closing popup loads blank #15

Open dottodot opened 5 years ago

dottodot commented 5 years ago

I'm wanting to use the popup to list some actions, some of which will open content in a modal once selected. However when I try this the modal (which works fine if opened using an ActionItem) loads completely blank.

I've added settimeout as I was getting an error of

ViewHierarchy: Parent is already presenting view controller. Close the current modal page before showing another one!

I suspect popover is somehow breaking standard modals but not sure why.

Doesn't work

<ActionBar [title]="project?.title" class="action-bar">
  <ActionItem ios.position="right" (tap)="showMenu()"><Label id="menu" text="Options"></Label></ActionItem>
</ActionBar>
showMenu() {
    const stack: any = new StackLayout();
    stack.height = '100%';
    const menulbl: any = new Label();
    menulbl.text = 'Edit';
    menulbl.height = 40;
    menulbl.paddingLeft = 10;
    menulbl.on('tap', args => {
      this.popup.hidePopup();
      setTimeout(() => {
        this.editProject(); // This opens a blank modal
      }, 500);
    });
    stack.addChild(menulbl);
    const stackhr: any = new StackLayout();
    stackhr.class = 'hr-light';
    stack.addChild(stackhr);
    const sv = new ScrollView();
    sv.content = stack;
    this._showMenu(this.page.getViewById('menu'), sv);
  }

Does work

<ActionBar [title]="project?.title" class="action-bar">
  <ActionItem ios.position="right" ios.systemIcon="2" (tap)="editProject()"></ActionItem>
</ActionBar>
FlawaCLV commented 4 years ago

+1