Skip to content

Commit

Permalink
Revert "Fix: back handler for Drawer"
Browse files Browse the repository at this point in the history
  • Loading branch information
marcaaron authored Nov 1, 2021
1 parent 7b4a3e5 commit 9d974e7
Show file tree
Hide file tree
Showing 9 changed files with 92 additions and 156 deletions.
1 change: 0 additions & 1 deletion config/webpack/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const includeModules = [

const webpackConfig = {
entry: {
polyfill: 'babel-polyfill',
app: './index.js',
},
output: {
Expand Down
111 changes: 51 additions & 60 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,10 @@
"@react-native-masked-view/masked-view": "^0.2.4",
"@react-native-picker/picker": "^1.9.11",
"@react-navigation/compat": "^5.3.15",
"@react-navigation/drawer": "6.1.7",
"@react-navigation/native": "6.0.5",
"@react-navigation/stack": "6.0.10",
"@react-navigation/drawer": "6.1.4",
"@react-navigation/native": "6.0.2",
"@react-navigation/stack": "6.0.7",
"babel-plugin-transform-remove-console": "^6.9.4",
"babel-polyfill": "^6.26.0",
"dotenv": "^8.2.0",
"electron-context-menu": "^2.3.0",
"electron-log": "^4.3.5",
Expand Down Expand Up @@ -93,7 +92,7 @@
"react-native-permissions": "^3.0.1",
"react-native-picker-select": "8.0.4",
"react-native-plaid-link-sdk": "^7.1.0",
"react-native-reanimated": "^2.3.0-beta.3",
"react-native-reanimated": "^2.3.0-alpha.1",
"react-native-render-html": "6.0.0-beta.8",
"react-native-safe-area-context": "^3.1.4",
"react-native-screens": "^3.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,41 @@ import _ from 'underscore';
import PropTypes from 'prop-types';
import {createDrawerNavigator} from '@react-navigation/drawer';
import {View} from 'react-native';
import styles, {getNavigationDrawerStyle, getNavigationDrawerType} from '../../../../styles/styles';
import Navigation from '../../Navigation';
import drawerNavigatorPropTypes from './drawerNavigatorPropTypes';
import styles, {getNavigationDrawerStyle, getNavigationDrawerType} from '../../../styles/styles';
import withWindowDimensions, {windowDimensionsPropTypes} from '../../../components/withWindowDimensions';
import Navigation from '../Navigation';

const propTypes = {
...drawerNavigatorPropTypes,
/** Screens to be passed in the Drawer */
screens: PropTypes.arrayOf(PropTypes.shape({
/** Name of the Screen */
name: PropTypes.string.isRequired,

/** Whether use the legacy implementation of Drawer */
useLegacyImplementation: PropTypes.bool.isRequired,
};
/** Component for the Screen */
component: PropTypes.elementType.isRequired,

/** Optional params to be passed to the Screen */
// eslint-disable-next-line react/forbid-prop-types
initialParams: PropTypes.object,
})).isRequired,

/** Drawer content Component */
drawerContent: PropTypes.elementType.isRequired,

/** If it's the main screen, don't wrap the content even if it's a full screen modal. */
isMainScreen: PropTypes.bool,

/** Window Dimensions props */
...windowDimensionsPropTypes,
};
const Drawer = createDrawerNavigator();

const BaseDrawerNavigator = (props) => {
const content = (
<Drawer.Navigator
backBehavior="none"
defaultStatus={Navigation.getDefaultDrawerState(props.isSmallScreenWidth)}
sceneContainerStyle={styles.navigationSceneContainer}
drawerContent={props.drawerContent}
useLegacyImplementation={props.useLegacyImplementation}
screenOptions={{
cardStyle: styles.navigationScreenCardStyle,
headerShown: false,
Expand Down Expand Up @@ -58,4 +72,4 @@ const BaseDrawerNavigator = (props) => {

BaseDrawerNavigator.propTypes = propTypes;
BaseDrawerNavigator.displayName = 'BaseDrawerNavigator';
export default BaseDrawerNavigator;
export default withWindowDimensions(BaseDrawerNavigator);

This file was deleted.

20 changes: 0 additions & 20 deletions src/libs/Navigation/AppNavigator/DrawerNavigator/index.js

This file was deleted.

16 changes: 0 additions & 16 deletions src/libs/Navigation/AppNavigator/DrawerNavigator/index.native.js

This file was deleted.

4 changes: 2 additions & 2 deletions src/libs/Navigation/AppNavigator/MainDrawerNavigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Permissions from '../../Permissions';
// Screens
import ReportScreen from '../../../pages/home/ReportScreen';
import SidebarScreen from '../../../pages/home/sidebar/SidebarScreen';
import DrawerNavigator from './DrawerNavigator';
import BaseDrawerNavigator from './BaseDrawerNavigator';
import {findLastAccessedReport} from '../../reportUtils';

const propTypes = {
Expand Down Expand Up @@ -56,7 +56,7 @@ const MainDrawerNavigator = (props) => {
// This way routing information is updated (if needed) based on the initial report ID resolved.
// This is usually needed after login/create account and re-launches
return (
<DrawerNavigator
<BaseDrawerNavigator
drawerContent={() => <SidebarScreen />}
screens={[
{
Expand Down
Loading

0 comments on commit 9d974e7

Please sign in to comment.