Page status when returning in navigation

Suppose the example: I have two pages, news and events. First use the news page, then navigate to events page, when returning to news page this keeps previous state (items, scroll, position of children items on the screen).

How do I go back to an already used page as if it were the first time?

Hi,

when you go back using either router.goBack() or the hardware back button on Android, the instance of the previous page is reused. And that is a good thing from performance perspective. Thus, there is no direct way to “go back to a page as if it were the first time”.

If you have a dedicated button, you could call a router.goto() or router.push() with new params, and that would make the page instance to be recreated. This does not solve the case when a user presses the hardware back button on Android.

If you need to reset ScrollPosition or do other cleanup tasks, you could put something like this on the page in question:

<WhileInactive>
    <Set myScrollView.ScrollPosition="0,0" />
    <Callback Handler="{doSomething}" />
</WhileInactive>

Hope this helps!