Skip to content

Navigator does not update background scenes on Android #387

@a-s-o

Description

@a-s-o

Hi,

I have run into an issue with the navigator where going back to a previous screen having updated the state does not reflect the changes on the previous screen. I.e. the previous screen is stale and not re-rendered. It works fine on the web and the issue is only on Android (I am not yet setup to test on iOS).

My actual use case is for a page with list of things which when clicked show details of a particular item. Then there is a button on the details page to delete the item which on press triggers a prop method. The prop method emits an event to delete the item and also navigates back to the list as a side effect. I do the state change asynchronously so during the back animation the item detail page does not error out (due to missing item). However, after the navigation back the list screen should then update once the state is changed. This is not happening. Neither setState nor forceUpdate re-render the list screen which is the expected behavior.

I have created an isolated example that is a simple counter to illustrate the problem. Here is the basic flow:

Code for the example is at https://gist.github.com/a-s-o/e6424ba1fc0527daaf35e391ec01b074

Initial load

screenshot_1513349138

Navigate to second page and click emit event button

screenshot_1513349143

Show first page again (but problem: state has not updated!)

screenshot_1513349147

On the web, this works just fine. The problem is only on Android. Additionally, we can be sure that the state updated because if I go back to page 2 it shows the correct counter value of 1

Thanks in advance; any help is very much appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions