我有带有 4 个选项卡的 BottomTabNavigator 我的结构如下面的屏幕截图所示。这是实现的底部标签栏下方的视图,但问题是我无法从主页/搜索选项卡导航到任何其他选项卡。另外,我尝试<Appcontainer />
在代码中如下所示传递导航,但它也不起作用。
我正在使用反应导航 v3.11.2
有没有其他方法可以在<Appcontainer />
. 或任何其他方法,以便我能够在 BootomTabs 中导航。
const Tabs = createBottomTabNavigator(
{
Home: {
screen: Home,
},
Search: {
screen: Search,
},
Add: {
screen: () => null,
navigationOptions: () => ({
tabBarOnPress: async ({ navigation }) => {
navigation.navigate('Upload');
}
}),
},
Profile: {
screen: Profile,
},
},
);
export default class ParentTabs extends React.Component {
render() {
const { navigate } = this.props;
return (
<View>
<AppContainer navigate={navigate} />
<View>
<Text>My Text</Text>
</View>
</View>
);
}
}
const AppContainer = createAppContainer(Tabs);