I'm creating a demo app and requirement is that on ios app must use tabs, and on Android must use drawer.
No problem, I created both configuration and applied live, and added to each screens both drawer-related and tabs-related configs.
I need to hide navbar icon which opens the drawer if screen is inside a tabnavigator, and show only if is inside a drawer navigator
Is there a way?
I found this solution
Please, post your answers, if found a better way
export default class Contacts extends React.Component {
static navigationOptions = ({ navigation }) => {
return {
title: 'Contacts',
headerLeft: navigation.actions.toggleDrawer
? (<MaterialIcons name="menu" size={24}
style={{ color: colors.grey, marginLeft: 10 }}
onPress={() => navigation.dispatch(DrawerActions.toggleDrawer())}
/>)
: null,
};
}
... rest of component code ..
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.