I have implemented deep link navigation with react-navigation (v6) in my RN app, but I am unable to pass the parameters. When I open my app with app://profile/123, my param 123 is passed as undefined in navigation state.
Currently my linking.ts looks like this:
const config = {
screens: {
BottomNavigator: {
screens: {
ProfileNavigator: {
screens: {
ProfileScreen: {
path: 'profile/:id',
parse: {
id: (id) => `${id}`,
},
exact: true,
},
},
},
SearchNavigator: { screens: { SearchScreen: 'search/:id' } },
},
},
},
};
const linking = {
prefixes: ['whitelabel://app'],
config,
};
export default linking;
I am trying to pass id to profile screen. The screen is passed correctly and opens the app on the right page, but the id is not passed through and returns undefined.
This is what I get from navigation state when the page opens:
{"index": 0, "key": "stack-jrLYL7iuBFvpeerYqTdcp", "routeNames": ["Profile"], "routes": [{"key": "Profile-lju0Bmsahv4w_wdmRUlMS", "name": "Profile", "params": undefined}], "stale": false, "type": "stack"}