反应本机导航4和深层链接

时间:2020-11-11 09:22:55

标签: android react-native react-navigation deep-linking

我难以解决使用RN Navigation 4设置深度链接的问题。我的代码如下:

BottomTabNavigator.js

(..)
const MapStack = createStackNavigator({Map:MapScreen,Settings:SettingsScreen},initialRouteName:'Map',});
MapStack.path = '';

const TestStack = createStackNavigator({Activity:ActivityScreen,Test:{ screen: TestScreen,path:'test/:testid'},},{initialRouteName:'Activity',});
TestStack.path = 'tests';

var tabs={MapStack,TestStack}
const tabNavigator = createBottomTabNavigator(tabs,{tabBarOptions:{style:{height:55,backgroundColor:'#6e465c'}}});
tabNavigator.path = 'app';

export default tabNavigator;

AppNavigator.js

import MainTabNavigator from './BottomTabNavigator';

export default createAppContainer(
    createSwitchNavigator({Main: MainTabNavigator})
);

App.js

const prefix = Linking.makeUrl('/');
return (<AppNavigator uriPrefix={prefix}/>)

我在app.json中将方案配置为“ myapp”,因此我在设备的浏览器(构建独立应用程序的地方)中尝试使用URL myapp:// app / tests / test / 1,但该应用程序未打开。怎么了?

0 个答案:

没有答案