我难以解决使用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,但该应用程序未打开。怎么了?