Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6290

Can't use passed params from deep link with React Navigation V6

$
0
0

I'm trying to configure simple linking logic to open app via invitation linklink would be something like this [scheme]://auth/[invitaion-code]

So I've configures the following linking object to pass it to the NavigationContainer

const linking: LinkingOptions<RootStackParamList> = {  prefixes: ['my app scheme'],  config: {    screens: {      Authorizer: {        path: "auth/:code",      },    },  },};

And defined the following navigation stack:

<NavigationContainer ref={navigationRef} linking={linking}><Stack.Navigator        screenOptions={{ headerShown: false }}        initialRouteName={initialRouteName}><Stack.Screen name="Authorizer" component={AuthorizerView} /></Stack.Navigator></NavigationContainer>

Now my question is how do I use the code param inside of my AuthorizerView Component?

I've tried this but it always comes out undefined

const AuthorizerView: React.FC<Props> = ({ navigation }: Props) => {  const {code} = navigation.params;

heres the log of the navigation object:

{"addListener": [Function addListener], "canGoBack": [Function canGoBack], "dispatch": [Function dispatch], "getId": [Function getId], "getParent": [Function getParent], "getState": [Function anonymous], "goBack": [Function anonymous], "isFocused": [Function isFocused], "navigate": [Function anonymous], "pop": [Function anonymous], "popToTop": [Function anonymous], "push": [Function anonymous], "removeListener": [Function removeListener], "replace": [Function anonymous], "reset": [Function anonymous], "setOptions": [Function setOptions], "setParams": [Function anonymous]}

This is related to this question but none of the answers on there worked for me so I'm trying to ask the question again


Viewing all articles
Browse latest Browse all 6290

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>