从底部选项卡打开抽屉导航器

Opening the Drawer navigator from the bottom tab

我正在将我的应用程序从 react-navigation 4 升级到 5。

在版本 4 中,我有一个选项卡可以使用以下代码打开抽屉

const MainNavigator = createBottomTabNavigator(
  {
More: {      
      screen: AdminNavigator,
      navigationOptions: {
        tabBarIcon: (tabInfo) => {
          //return <Ionicons name="ios-star" size={25} color={tabInfo.tintColor} />;
          return (
            <Icon
              name="tune"
              color={tabInfo.tintColor}
              size={tabInfo.focused ? 32 : 28}
              style={{
                paddingTop: 10,
              }}
            />
          );
        },
        tabBarColor: Colors.primary,       
        tabBarOnPress: ({ navigation }) => {
          navigation.openDrawer();
        },
      },
    },
}

在新版本 5 中,我有以下导航配置

<NavigationContainer>          
    <Drawer.Navigator>
       <Drawer.Screen name="Home" component={TabsScreen} />
       <Drawer.Screen name="Favorites" component={FavoritesStackScreen} />
       <Drawer.Screen name="Language" component={LanguageStackScreen} />
    </Drawer.Navigator>
</NavigationContainer>

其中 TabScreen 是我的底部标签导航器

const TabsScreen = () => (
    <Tabs.Navigator>
        <Tabs.Screen name={"Home"} component={HomeStackScreen} />
        <Tabs.Screen name={"Cocktails"} component={CocktailsStackScreen} />
        <Tabs.Screen 
            name={"More"} 
            component={HomeStackScreen} 
            options={{
                ...
            }}
        />
    </Tabs.Navigator>
);

我正在寻找以下 V5 中的等效项

tabBarOnPress: ({ navigation }) => {
          navigation.openDrawer();
        },

尝试以下操作:

<Tabs.Screen 
  name={"More"} 
  component={HomeStackScreen} 
  listeners={({ navigation }) => ({
    tabPress: e => {
      e.preventDefault();
      navigation.openDrawer();
    }
  })}
/>

https://reactnavigation.org/docs/navigation-events/#listeners-prop-on-screen