Friday, 24 January 2020

how to display modal window in nativescript-vue

I have a nativescript-vue app where I call a vue file to populate a grid, and when selected, return that value. That all works beautifully the first time (thanks to this work).

Here is how I call it from the parent window:

 this.$showModal(MyListView, { props: { apropValue : this.apropValue }, fullscreen: true }
                        ).then(data => this.myvalue = data);

In the MyListView.vue file I load a GridLayout that displays properly and returns the selected value as desired.

<ListView for="item in items" class="list-group"  @itemTap="onItemListTap">
...
 onItemListTap(args) {               
    this.$modal.close(args.item);
 }

So far so good, but I am seeing a weird behavior when I run it on my iOS device. The first time, this works great. But next time I call it I see this in the console and do not see the modal:

CONSOLE ERROR file:///node_modules/tns-core-modules/trace/trace.js:178:30: ViewHierarchy: Parent is already presenting view controller. Close the current modal page before showing another one!

I cannot find any example of how to close a current modal page since I am already closing it. Interestingly, even after I close the app, rebuild and restart on my device it shows that error again and doesn't show the modal.

Can anyone see what I am doing wrong?



from how to display modal window in nativescript-vue

No comments:

Post a Comment