我的嵌套堆栈导航设置是这样的。抽屉导航器是我的根组件,由堆栈导航器组成,其中嵌套了一个选项卡导航器
const AppStack = () => {
const navigation = useNavigation<any>()
const TabStack = () => (
<Tab.Navigator screenOptions={screenOptions}>
<Tab.Screen
name="Home"
component={HomeStack}
/>
<Tab.Screen
name="Trending"
component={TrendingScreen}
headerShown: true,
headerTintColor: getColor('white'),
headerStyle: tailwind('bg-purple-800'),
headerTitleAlign: 'center',
}}
/>
<Tab.Screen
name="Post"
component={PostScreen}
/>
<Tab.Screen
name="Search"
component={SearchScreen}
/>
<Tab.Screen
name="Profile"
component={ProfileScreen}
/>
</Tab.Navigator>
)
const MainStack = () => (
<Stack.Navigator
screenOptions={{
headerShown: false,
}}
>
<Stack.Screen name="Explore" component={TabStack} />
<Stack.Screen
name="Messages"
component={MessagesScreen}
/>
<Stack.Screen
name="Notifications"
component={NotificationsScreen}
/>
<Stack.Screen
name="EditProfile"
component={EditProfileScreen}
/>
<Stack.Screen
name="tagPosts"
component={TagPostScreen}
/>
<Stack.Screen
name="countryPosts"
component={CountryPostScreen}
/>
<Stack.Screen
name="locationPosts"
component={LocationPostScreen}
/>
<Stack.Screen
name="postDetails"
component={PostDetailsScreen}
/>
<Stack.Screen
name="Map"
component={MapScreen}
/>
</Stack.Navigator>
)
return (
<Drawer.Navigator
screenOptions={{
headerShown: false,
}}
drawerContent={(props) => <DrawerContent {...props} />}
>
<Drawer.Screen name="Main" component={MainStack} />
</Drawer.Navigator>
)
}
export default AppStack
主页堆栈导航器
const HomeStack = () => {
return (
<TopTab.Navigator
initialRouteName="World"
screenOptions={{
tabBarIndicatorStyle: tailwind('border-purple-800 border-2'),
tabBarStyle: tailwind('bg-purple-100'),
tabBarInactiveTintColor: getColor('purple-400'),
tabBarActiveTintColor: getColor('purple-800'),
tabBarLabelStyle: {
textTransform: 'none',
fontSize: 20,
},
}}
>
<TopTab.Screen
name="World"
component={WorldScreen}
options={{
tabBarLabel: 'World',
}}
/>
<TopTab.Screen
name="YourPicks"
component={PicksScreen}
options={{
tabBarLabel: 'Your Picks',
}}
/>
</TopTab.Navigator>
)
}
export default HomeStack
下面是我的链接
const linking: LinkingOptions<any> = {
prefixes: [prefix],
config: {
screens: {
Main: {
path: 'main',
screens: {
Explore: {
path: 'explore',
screens: {
Home: {
initialRouteName: 'World',
path: 'worldPath',
screens: {
World: 'world',
YourPicks: 'yourpicks',
},
},
},
},
},
},
NotFound: '*',
},
},
}
我已经尝试过npx uri-scheme open exp://128.0.0.1:19000/--/main/explore/worldPath --ios
,但我的模拟器没有任何反应。
有谁知道我在这里可能会错过什么?非常感谢任何解决此问题的帮助!