hotwired / hotwire-native-android

Hotwire Native for Android
MIT License
41 stars 5 forks source link

Fix navigation stack when a modal submits a form #40

Open jayohms opened 6 months ago

jayohms commented 6 months ago

With the Navigator refactor, the form redirect url replaces the root destination. This needs to be fixes so it pushes a new destination onto the root after the modal is dismissed.

See demo app Load a webpage modally -> Submit Form

MichalSznajder commented 2 months ago

FYI also recede functionality is affected. After adding to demo app this code:

{
  "patterns": [
    "/success$"
  ],
  "properties": {
    "presentation": "pop"
  }
},

doing Load a webpage modally -> Submit Form will pop both modal and root view.

My workaround for now was a custom RouteDecisionHandler that reacts on recede and pops only modal:

if (uri.path?.startsWith(Locations.RECEDE_PATH) == true) {
    activity.delegate.currentNavigator?.pop()
    return
}

I mention it since recede is mentioned in docs and out of the box it is broken for now.