How can I navigate back 2 modals?

My app flow is like:

Page 1
→ Open Page 2 as a modal (to hide the nav bar)
→ Open Page 3 as a modal
→ Go back to Page 1

However, I run into various problems that prevent me from going from Page 3 to Page 1:

  • From Page 3, the “Open page” flow function doesn’t seem to do anything
  • From Page 3, using “Navigate back” to go 2 pages doesn’t go two pages - it only goes one.

(Testing in latest Preview version on Android)

How can I get back two pages from Page 3? Or, how can I hide the bottom nav on Page 2? I saw mentions of there being an option in Properties, but I don’t see that.

Thanks!

Hi, check out the Navigate back to root flow function (docs), it will pop all pages from your navigation stack returning you to Page 1.

Also, on the Navigate Back flow function you can specify the number of pages to go back.

1 Like

@Mari This appears to work, thanks. It’d be nice if that was just an option on the “Navigate back” module…I never thought to look for this as a separate flow function.

@JOHN_WORSHAM Yeah, I tried this, but it wasn’t working for me. No matter what number of pages I entered, it only ever went back 1 page.

1 Like

@Mari I take it back…I’m still stuck here. Somehow I’m unable to get the user back to Page 1 at all.

I’ve tried several things on Page 3 (a modal which was opened from Page 2, a modal, which was opened from Page 1, the root), and none work properly:

  • Open Page (Page 1): Does nothing
  • Replace Page (Page 1): Does nothing
  • Navigate back (2 pages): Goes back 1 page (to Page 2)
  • Navigate to root: Goes back 1 page (to Page 2)

Any ideas? Seems like at least one of these should do what I want…

Hi @Joel_D, I did some testing and looks like in the web preview (Launch → Open app preview portal) the Navigate to root flow function works correctly, but in iOS preview app it’s as you explained, it only goes back one page. I’ll report it as a bug to the development team! :slight_smile:

Alright, thanks. I noticed this behavior on Android.

Should the Open Page/Replace page flow functions work when called from a modal? For me they do nothing at all.

@Mari Any ideas here? I’m kind of stuck with my app…my users get to Page 3, and I have no way of getting them back to Page 1. : \

Hi, the problem is due to the first modal that opens creating a new “root” in the navigation stack and thus you can’t navigate back to the original “root” from a page that has been opened from the first modal. I would suggest a workaround where you use the Conditional Renderer component to render two different contents on the same modal page. You can use e.g. a page variable to switch between the views, and then “navigate back” from the second view.