2

I have implemented deep linking in my app. My app is opening using added links but unable to get query params from one link

here is the code of my deep linking config

const linking = {
  prefixes: ['demo://'],
  config: {
    screens: {
      Signup: {
        path: 'SignUp',
      },
      SignupInvitation: {
        path: 'user/invite/invite_code/:invitecode',
        parse: {
          invitecode: (invitecode: string) => {
            console.log('Code ', invitecode);
            storeToken(invitecode);
            return `${invitecode}`;
          },
        },
      },
      ResetPassword: {
        path: 'reset_password',
      },
    },
  },
};

here is the complete link:

https://myapp.com/reset_password?access-token=abcdw&client=abcdef&client_id=abcdef&config=default&expiry=1646292840&reset_password=true&token=abcd&uid=abc@gmail.com

I want to get access-token, client, and uid from this link. how can I get it?

AmerllicA
  • 29,059
  • 15
  • 130
  • 154
Muhammad Umar
  • 190
  • 1
  • 3
  • 15

1 Answers1

-1

Here is my working example:

navigations.ts

Loading: {
  path:
    'Loading/:routeName/:key1?/:value1?/:key2?/:value2?/:key3?/:value3?',
  screen: Loading,
},

Loading.tsx

const Loading = ({{ navigation }}) => {
const routeName = navigation.getParam("routeName")
useEffect(() => {
  const params = {
    [navigation.getParam("key1")]: navigation.getParam("value1"),
    [navigation.getParam("key2")]: navigation.getParam("value2"),
    [navigation.getParam("key3")]: navigation.getParam("value3"),
  }
  console.log({ params })
})
navigation.navigate(routeName, params)
}

and finally the link I use for returning back to the app

billing-app://Loading/InviteScreen/refresh/true
Ahmad Khani
  • 850
  • 2
  • 10
  • 15
  • 1
    Brother you are using optional parameters in route, these are not query params, please check my link. I need query params not dynamic optional routing params – Muhammad Umar Mar 02 '22 at 10:18