Skip to content

Commit

Permalink
Revert changes made in #9706
Browse files Browse the repository at this point in the history
  • Loading branch information
marcaaron committed Jul 26, 2022
1 parent c5fb877 commit 5f16ef9
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions src/libs/Navigation/CustomActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ import {
CommonActions, StackActions, DrawerActions, getStateFromPath,
} from '@react-navigation/native';
import lodashGet from 'lodash/get';
import {Dimensions} from 'react-native';
import linkingConfig from './linkingConfig';
import navigationRef from './navigationRef';
import variables from '../../styles/variables';

/**
* @returns {Object}
Expand Down Expand Up @@ -71,9 +69,6 @@ function getScreenNameFromState(state) {
*/
function pushDrawerRoute(route) {
return (currentState) => {
const initialDimensions = Dimensions.get('window');
const isSmallScreenWidth = initialDimensions.width <= variables.mobileResponsiveWidthBreakpoint;

// Parse the state, name, and params from the new route we want to navigate to.
const newStateFromRoute = getStateFromPath(route, linkingConfig.config);
const newScreenName = getScreenNameFromState(newStateFromRoute);
Expand Down Expand Up @@ -108,18 +103,13 @@ function pushDrawerRoute(route) {
// Force drawer to close
// https://github.com/react-navigation/react-navigation/blob/94ab791cae5061455f036cd3f6bc7fa63167e7c7/packages/routers/src/DrawerRouter.tsx#L142
const hasDrawerhistory = _.find(state.history || [], h => h.type === 'drawer');
if (isSmallScreenWidth && (!hasDrawerhistory || currentState.type !== 'drawer')) {
if (!hasDrawerhistory || currentState.type !== 'drawer') {
history.push({
type: 'drawer',

// If current state is not from drawer navigator then always use closed status to close the drawer
status: currentState.type !== 'drawer' || currentState.default === 'open' ? 'closed' : 'open',
});
} else {
history.push({
type: 'route',
name: newScreenName,
});
}

return CommonActions.reset({
Expand Down

0 comments on commit 5f16ef9

Please sign in to comment.