sag*_*agi 15 navigation deep-linking react-native expo
我正在我的 React Native 应用程序中实现与 expo 的深度链接。我已经成功地使用此代码和本教程以及本文档来将其调整为我的嵌套堆栈:
const linking = {
prefixes:[prefix],
config: {
screens: {
Drawer: {
screens: {
Tabs: {
screens: {
Profile:"profile"
}
}
}
},
}
}
}
return (
<NavigationContainer linking={linking}>
<RootStackScreen actions={actions} showLoader={showLoader} user={user} {...props} />
</NavigationContainer>
)
Run Code Online (Sandbox Code Playgroud)
}
如果我使用myscheme://profile它,它会按预期工作,但前提是该应用程序在后台打开。当应用程序关闭时,它只是在我的初始主屏幕中打开它,我尝试谷歌搜索和搜索,但找不到任何适合我所做的解释。我还尝试添加getInitialRoute该功能linking,该功能在应用程序关闭并从深层链接打开时触发,但无法弄清楚如何使用它来激活导航。
async getInitialURL() {
const url = await Linking.getInitialURL(); // This returns the link that was used to open the app
if (url != null) {
//const { path, queryParams } = Linking.parse(url);
//console.log(path,queryParams)
//Linking.openURL(url)
return url;
}
},
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6752 次 |
| 最近记录: |