I am using a deep link which sends me to my app in a specific page but I want to read the link it that page. For example: My link is "my app://somepage/code=123", I want to take this code value from url after I open the link.
Reading Url with React Native Deep Linking
579 Views Asked by nodabasi At
2
There are 2 best solutions below
0

Ok, I found a method which allows me to run a function whenever I open my page.
useEffect(() => {
navigation.addListener('focus', () => {
getCode();
});
}, []);
In the getCode function, I'm using getInitialUrl() function, here is the docs for more info, https://reactnative.dev/docs/linking#getini… You can use this module to collect the coming url and do whatever you want.
You just need to take the
params
fromroute