Am working on deep linking, I integrated Linking and created deep link. Its worked fine but when i click back button then page redirect to previous screen and suddenly it redirect to chat page am not able to clear the URL when i come back.
componentDidMount() {
Linking.getInitialURL().then(url => {
this.navigate(url);
}).catch(err => {
console.warn(">>>>>>>>>err", err)
});
Linking.addEventListener('url', this.handleOpenURL);
}
componentWillUnmount() {
Linking.removeEventListener('url', this.handleOpenURL);
}
handleOpenURL = (event) => {
this.navigate(event.url);
}
navigate = (url) => {
if (url === "appchat://chat/") {
//when i comeback url hit here and page redirected automatically
this.props.navigation.navigate('chat')
} else {
this.props.navigation.navigate('dashboard')
}
}