I use linking for opening my app from the browser.
When I tap the link for first in-browser my app run but incoming URL don't clear after that and linking.GetInitialUrl()
always run with that URL.
My schema is myapp://host
and my URL on the web is myapp://host/ok
I click on my URL and linking.getInitialUrl()
works but when next time I'm back to My screen linking.getInitialUrl()
return my web URL without open web page by me.
componentDidMount() {
Linking.getInitialURL().then(url => {
if (url) {
alert(url)
}
})
.catch(err => {
console.error(err);
});
Linking.addEventListener('url',this.handleOpenURL);
}
componentWillUnmount() { Linking.removeEventListener('url',this.handleOpenURL);
}
handleOpenURL = (event) => { // D
this.linkFunc(event.url);
}