commonActions.setParams does not update params

Viewed 23

I'm trying to set the params for a screen from a custom tab bar component. Using the example from the docs does not work for me. The screen is part of a nested navigation stack and I have a feeling that is part of my problem.

--> drawer stack
----> tab stack
------> native stack
        -> dashboard screen
        -> booking screen
        -> diary screen

The navigation state object for the tabs look like this.

{
    "stale": false,
    "type": "tab",
    "key": "tab-JmPDy2NwyVFfJQL__lIyb",
    "index": 0,
    "routeNames": [
        "Tab/Dashboard",
        "Tab/Bookings",
        "Tab/Diary"
    ],
    "history": [
        {
            "type": "route",
            "key": "Tab/Dashboard-nSjIaQSJzvdnYaOpTHDuW"
        }
    ],
    "routes": [
        {
            "name": "Tab/Dashboard",
            "key": "Tab/Dashboard-nSjIaQSJzvdnYaOpTHDuW",
            "params": {
                "screen": "Dashboard",
                "params": {
                    "propertyName": "Some property name"
                }
            }
        },
        {
            "name": "Tab/Bookings",
            "key": "Tab/Bookings-rbjc7YpzjTz9otIkRnRtJ"
        },
        {
            "name": "Tab/Diary",
            "key": "Tab/Diary-s6lgCzSfNw4xu4AuFdJB7"
        }
    ]
}

routeKey = Tab/Diary-s6lgCzSfNw4xu4AuFdJB7

navigation.dispatch({
     ...CommonActions.setParams({ resetDate: true }),
     source: routeKey,
});

I also tried target: routeKey but also does not update that screen's params.

0 Answers
Related