问题描述
我有一个深层链接配置设置,可以在设备上单击 URL 时打开特定页面。当应用在后台打开时,这工作正常,但如果应用关闭,它只会打开应用而不会导航。
这是我的链接配置:
const linking = {
prefixes: ["appname://"],config: deepLinkRouting,getStateFromPath(path:string,options:any) {
//build custom params
},async getinitialURL() {
// Check if app was opened from a deep link
const url = await Linking.getinitialURL();
if (url != null) {
return url;
}
},subscribe(listener) {
const onReceiveURL = ({ url }) => listener(url);
Linking.addEventListener('url',onReceiveURL);
return () => {
// Clean up the event listener
Linking.removeEventListener('url',onReceiveURL);
};
},}
此链接对象作为道具提供给我的 <NavigationContainer/>
我正在使用 npx uri-scheme open
命令在模拟器上对此进行测试。我注意到当您关闭应用程序并重新打开它时,应用程序会重建,所以我想知道这是否会使测试无效。任何帮助表示赞赏!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)