mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-04-28 20:35:19 +08:00
Fix issue in drawer actions (#3667)
* Fix issue in drawer actions * Update DrawerView.js
This commit is contained in:
@@ -45,7 +45,6 @@ class DrawerSidebar extends React.PureComponent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
_onItemPress = ({ route, focused }) => {
|
_onItemPress = ({ route, focused }) => {
|
||||||
this.props.navigation.navigate('DrawerClose');
|
|
||||||
if (!focused) {
|
if (!focused) {
|
||||||
let subAction;
|
let subAction;
|
||||||
// if the child screen is a StackRouter then always navigate to its first screen (see #1914)
|
// if the child screen is a StackRouter then always navigate to its first screen (see #1914)
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import DrawerLayout from 'react-native-drawer-layout-polyfill';
|
|||||||
|
|
||||||
import addNavigationHelpers from '../../addNavigationHelpers';
|
import addNavigationHelpers from '../../addNavigationHelpers';
|
||||||
import DrawerSidebar from './DrawerSidebar';
|
import DrawerSidebar from './DrawerSidebar';
|
||||||
|
import NavigationActions from '../../NavigationActions';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Component that renders the drawer.
|
* Component that renders the drawer.
|
||||||
@@ -36,12 +37,12 @@ export default class DrawerView extends React.PureComponent {
|
|||||||
|
|
||||||
_handleDrawerOpen = () => {
|
_handleDrawerOpen = () => {
|
||||||
const { navigation } = this.props;
|
const { navigation } = this.props;
|
||||||
navigation.dispatch({ type: 'DrawerOpenAction' });
|
navigation.dispatch({ type: NavigationActions.OPEN_DRAWER });
|
||||||
};
|
};
|
||||||
|
|
||||||
_handleDrawerClose = () => {
|
_handleDrawerClose = () => {
|
||||||
const { navigation } = this.props;
|
const { navigation } = this.props;
|
||||||
navigation.dispatch({ type: 'DrawerCloseAction' });
|
navigation.dispatch({ type: NavigationActions.CLOSE_DRAWER });
|
||||||
};
|
};
|
||||||
|
|
||||||
_updateWidth = () => {
|
_updateWidth = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user