Skip to content

Support for history stack entry replace #6283

@bundyo

Description

@bundyo

Did you verify this is a real problem by searching the NativeScript Forum and the other open issues in this repo?

Yes

Tell us about the problem

While developing an app, I noticed that {N} doesn't support history replacement as the one the History API has in Web. backstackVisible: false comes close, but has one subtle difference, which I will describe now:

                             navigate()
        +---------------------------------------------------+
        |             backstackVisible: false               |
        |                                                   |
+-------v------+        goBack()         +---------------+  |
|              <-------------------------+ Cancel   Done +--+
+--------------+                         +---------------+
|              |        navigate()       |               |
| Details Page +------------------------->   Edit Page   |
|              | backstackVisible: false |               |
+--------------+                         +---------------+

If we use backstackVisible: false, the edit page doesn't enter the stack and goBack() navigates properly on canceling Edit page. However, if we want to navigate to the Details page on Done (to indicate with forward transition, that the changes were stored), the new Details Page is not replacing the old one, and using goBack() in it will navigate it to its previous stack copy - from itself to itself.

In the Web History API, replace is effectively replacing the page in the stack, so going back will just navigate to the previous one in the stack - the correct one.

Using clearHistory in this case is not okay, as we have previous pages in the stack, which we will lose.

Which platform(s) does your issue occur on?

iOS/Android/Both


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions