【发布时间】:2021-01-11 15:24:44
【问题描述】:
我有以下域:https://demoproject.com
我想将所有带有 /demo 路径参数的 URL 链接到我在 Android 上的 React Native 应用程序,以便例如 URL https://demoproject.com/demo?a=1&b=2 将被链接,但任何其他具有相同域但路径参数不同的 URL 将被排除在外。
现在我正在使用这样的 React Navigation 5:
const linking = {
prefixes: ['https://demoproject.com'],
config: {
DemoScreen: {
path: '/demo/*'
}
}
};
<NavigationContainer linking={linking}>
AndroidManifest.xml
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" />
<data android:host="demoproject.com" />
</intent-filter>
链接本身工作正常,但问题是所有带有前缀 https://demoproject.com 的 URL 都被链接,而我只希望链接带有 /demo 路径参数的 URL。
我试过了:
-
<data android:host="demoproject.com/demo" />- 所有 URL 均未链接 -
prefixes: ['https://demoproject.com/demo']- 所有带有https://demoproject.com域的 URL 都已链接
任何想法如何解决这个问题或我在这里做错了什么?
【问题讨论】:
标签: javascript android react-native react-navigation deep-linking