【发布时间】:2018-05-14 10:40:21
【问题描述】:
我已关注此文档https://rnfirebase.io/docs/v4.1.x/links/android 并能够运行adb shell am start -W -a android.intent.action.VIEW -d "https://abc123.app.goo.gl" com.myapp.superapp 来启动应用程序。
如何打开动态链接https://abc123.app.goo.gl它打开VideoScreen并传递contentparam
Video:{
screen : VideoScreen,
path:'wvc/:contentparam',
}
所以我在点击https://abc123.app.goo.gl(动态链接)时尝试了这个:
componentDidMount () {
Linking.getInitialURL().then((url) => {
console.log('Initial url is: ' + url);
}).catch(err => console.error('An error occurred', err));
}
但是应用程序打开但console.log 给定null
【问题讨论】:
-
你在使用
react-navigation吗? -
@bennygenel 是,但
react-navigation深层链接无法在浏览器中打开 -
如果你想使用来自
react-navigation的path属性,你需要结合来自firebase 的链接和来自react-navigation 的深度链接。另一种方法是收听手动导航用户的link events。 -
你的意思是
Linking.getInitialURL()是https://abc123.app.goo.gl,如果链接是动态链接,那么做点什么? -
@bennygenel 嗨,我试试你的建议
Linking,问题已更新
标签: android firebase react-native firebase-dynamic-links react-native-firebase