Toggle drawer by tab bar button press with an anonymous inline function
I'm having a hard time to know what to do to make this work! I tried to pass props but I could't make it work. I tried to use static methods on the drawer class, yet, failed. I can use any help, and a good solution, thanks.
Here are the relevant codes:
export const MyCustomTab = createBottomTabNavigator(
{
profile: ProfilePage,
menu: {
screen: () => null,
navigationOptions: () => ({
tabBarOptions: {
showLabel: false
},
tabBarIcon: (
<TouchableOpacity onPress = {() => [TOGGLE HERE]}>
<Image style = {MainStyles.TabbarMenuIcon} source={require('./resources/Icons/tab_bar_menu.png')}></Image>
</TouchableOpacity>
),
tabBarOnPress: () => {[TOGGLE HERE]}
})
},
},
const MyCustomDrawer = createDrawerNavigator(
{
Main: {
screen: MainScreen
},
Setting: {
screen: SettingScreen
}
}
class MainScreen extends React.Component {
constructor(props) {
super(props);
}
static navigationOptions = {
drawerLabel: 'main screen',
};
render() {
return (
<MyCustomTab/>
);
}
}
What should I type instead of [TOGGLE HERE] to access the drawer props navigation and toggle it? (We are in myCustomTab)
Just a quick note, the tab bar 'menu' button directs to nothing, no screen, I'm using it only as a button to open the drawer, which I'm having problems making it work!
This will be possible when https://github.com/wix/react-native-navigation/issues/2766 is resolved.
@guyca the disabling buttons or adding onClick supports? I need neither of them right now. My problem is just how to pass the props in between these two navigations
@proxyjan the createBottomTabNavigatoris part of react-navigation and not react-native-navigation, I think you should post the issue in the right repo react-navigation.
@ketimaBU holy moly you're right! geez! Thank you! I post the question there!
Most helpful comment
@ketimaBU holy moly you're right! geez! Thank you! I post the question there!