我正在研究深度链接,我集成了链接并创建了深度链接。它工作正常,但是当我单击返回按钮时,页面重定向到上一个屏幕,突然它重定向到聊天页面,当我回来时无法清除 URL。
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')
}
}