Reputation: 15
I had set up a navigator drawer that works perfectly, but since this morning I have this error. I do not know where it came from. Because I did not make any changes on the drawer. I can't use the function close drawer.
<Left style={{flex :1, flexDirection: 'row'}}>
<Icon
onPress={() => this.props.navigation.openDrawer()} name="menu"
tyle={{color: 'black', marginRight: 15,}} />
</Left>
the error is :
undefined is not an object (evaluating '_this.props.navigation.openDrawer()')
Upvotes: 1
Views: 926
Reputation: 962
You can Try this
import { DrawerActions } from 'react-navigation';
this.props.navigation.dispatch(DrawerActions.closeDrawer());
this.props.navigation.dispatch(DrawerActions.openDrawer());
Upvotes: 2