diff --git a/config/webpack/webpack.common.js b/config/webpack/webpack.common.js index a2e79d449c99..45a2e6b73bea 100644 --- a/config/webpack/webpack.common.js +++ b/config/webpack/webpack.common.js @@ -26,7 +26,6 @@ const includeModules = [ const webpackConfig = { entry: { - polyfill: 'babel-polyfill', app: './index.js', }, output: { diff --git a/package-lock.json b/package-lock.json index bea13bfd8c35..d9bc04f785d3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6242,11 +6242,11 @@ "integrity": "sha512-Gh5O6Ng3z0/qSBhuuWuPSi24+RrkgNy5hzvEke8qjS+kbrPfSFLD6aq9B2Fdfndp/dAyfxgTi6aULUsnv847Hw==" }, "@react-navigation/core": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/@react-navigation/core/-/core-6.0.3.tgz", - "integrity": "sha512-Kan/mpsCsb4NS1A+yIVpWfj6BITM051QAaQM8osWB5AfEsANhG+fCjSKL4Zv5idXpF0vxDbudj6CfnwJTnja6Q==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/@react-navigation/core/-/core-6.0.1.tgz", + "integrity": "sha512-mVdvBDYdz8uzLQHokmVdX/xC4rS7NIkD1FN/yaGdovVzYApAhM+UGd3w1zskjyCSyXaVHHOwV59ZGVew+84xfQ==", "requires": { - "@react-navigation/routers": "^6.0.2", + "@react-navigation/routers": "^6.0.1", "escape-string-regexp": "^4.0.0", "nanoid": "^3.1.23", "query-string": "^7.0.0", @@ -6261,26 +6261,26 @@ } }, "@react-navigation/drawer": { - "version": "6.1.7", - "resolved": "https://registry.npmjs.org/@react-navigation/drawer/-/drawer-6.1.7.tgz", - "integrity": "sha512-DmLsQCmqQ7NeOvBkLintqh26QgdhRTBZnNZ3L6cANo7oVjmyhyZOM6k7+htm19XizA9NnZ60Nbj7R7QJLDIYRg==", + "version": "6.1.4", + "resolved": "https://registry.npmjs.org/@react-navigation/drawer/-/drawer-6.1.4.tgz", + "integrity": "sha512-lmWV/Hxd60LFLsHESOXkDXZmzqpXHoRhBdaxk5FvQHXSBYm+ZB0bP9vq5nTCzUby513wTyM381GBujdgYWCGRA==", "requires": { - "@react-navigation/elements": "^1.2.0", + "@react-navigation/elements": "^1.1.0", "color": "^3.1.3", "warn-once": "^0.1.0" } }, "@react-navigation/elements": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@react-navigation/elements/-/elements-1.2.0.tgz", - "integrity": "sha512-0eraS7Gj39CD26aAyUyZdyoCe1XBEa9CbHoFHCv3N5/+FSfX+HYdPzkOi3KPT3nEdNx7GD4rTWN2y0qZ7yUiaA==" + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@react-navigation/elements/-/elements-1.1.0.tgz", + "integrity": "sha512-jZncciZPGuoP6B6f+Wpf6MYSSYy86B2HJDbFTCtT5xZV0w6V9GgCeqvSTOEAxifZrmKl8uDxsr0GrIxgQE8NxA==" }, "@react-navigation/native": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/@react-navigation/native/-/native-6.0.5.tgz", - "integrity": "sha512-e23rhomQS98sNMcldO2mPVFOcpizrkfdZ6d7wK8nXhkd/m43IvhGmzAgpX4Iz7MFbOFsHGlDRzwba3nlYIGm1Q==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/@react-navigation/native/-/native-6.0.2.tgz", + "integrity": "sha512-HDqEwgvQ4Cu16vz8jQ55lfyNK9CGbECI1wM9cPOcUa+gkOQEDZ/95VFfFjGGflXZs3ybPvGXlMC4ZAyh1CcO6w==", "requires": { - "@react-navigation/core": "^6.0.3", + "@react-navigation/core": "^6.0.1", "escape-string-regexp": "^4.0.0", "nanoid": "^3.1.23" }, @@ -6293,19 +6293,19 @@ } }, "@react-navigation/routers": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/@react-navigation/routers/-/routers-6.0.2.tgz", - "integrity": "sha512-VEyBlpY+TBMTKE7qaWll/CUYcRctCrJAFx6jIgzkSxncsCOtgEeDEsDLggkGQEVAwOnftAiuXeVRlHkRswIXiw==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/@react-navigation/routers/-/routers-6.0.1.tgz", + "integrity": "sha512-5ctB49rmtTRQuTSBVgqMsEzBUjPP2ByUzBjNivA7jmvk+PDCl4oZsiR8KAm/twhxe215GYThfi2vUWXKAg6EEQ==", "requires": { "nanoid": "^3.1.23" } }, "@react-navigation/stack": { - "version": "6.0.10", - "resolved": "https://registry.npmjs.org/@react-navigation/stack/-/stack-6.0.10.tgz", - "integrity": "sha512-BaNtmkSIY18+kVbry5Pao2xys0imSWoEJ3KUdXmNv6iR9T8JNL74rf5ecUFVtcY9RBnEf9CvbDwudBYCCSLvSA==", + "version": "6.0.7", + "resolved": "https://registry.npmjs.org/@react-navigation/stack/-/stack-6.0.7.tgz", + "integrity": "sha512-hxwhRZbn6zD2rInhItBeHTCPYzmurz+/8/MhtRevBEdLG0+61dik8Y+evg/mu6AsOU0WrDakTsLcHdf/9zkXzw==", "requires": { - "@react-navigation/elements": "^1.2.0", + "@react-navigation/elements": "^1.1.0", "color": "^3.1.3", "warn-once": "^0.1.0" } @@ -14734,11 +14734,6 @@ "integrity": "sha512-giAlZwstKbmvMk1OO7WXSj4OZ0keXAcl2TQq4LWHiiPH2ByaH7WeUzng+Qej8UPxxv+8lRTuouo0iaNDBuzIBA==", "dev": true }, - "@types/invariant": { - "version": "2.2.35", - "resolved": "https://registry.npmjs.org/@types/invariant/-/invariant-2.2.35.tgz", - "integrity": "sha512-DxX1V9P8zdJPYQat1gHyY0xj3efl8gnMVjiM9iCY6y27lj+PoQWkgjt8jDqmovPqULkKVpKRg8J36iQiA+EtEg==" - }, "@types/is-function": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@types/is-function/-/is-function-1.0.1.tgz", @@ -16837,23 +16832,6 @@ "resolved": "https://registry.npmjs.org/babel-plugin-transform-remove-console/-/babel-plugin-transform-remove-console-6.9.4.tgz", "integrity": "sha1-uYA2DAZzhOJLNXpYjYB9PINSd4A=" }, - "babel-polyfill": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-polyfill/-/babel-polyfill-6.26.0.tgz", - "integrity": "sha1-N5k3q8Z9eJWXCtxiHyhM2WbPIVM=", - "requires": { - "babel-runtime": "^6.26.0", - "core-js": "^2.5.0", - "regenerator-runtime": "^0.10.5" - }, - "dependencies": { - "regenerator-runtime": { - "version": "0.10.5", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz", - "integrity": "sha1-M2w+/BIgrc7dosn6tntaeVWjNlg=" - } - } - }, "babel-preset-current-node-syntax": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-0.1.4.tgz", @@ -16921,6 +16899,7 @@ "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "dev": true, "requires": { "core-js": "^2.4.0", "regenerator-runtime": "^0.11.0" @@ -16929,7 +16908,8 @@ "regenerator-runtime": { "version": "0.11.1", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", - "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==" + "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==", + "dev": true } } }, @@ -32854,9 +32834,9 @@ "optional": true }, "nanoid": { - "version": "3.1.29", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.29.tgz", - "integrity": "sha512-dW2pUSGZ8ZnCFIlBIA31SV8huOGCHb6OwzVCc7A69rb/a+SgPBwfmLvK5TKQ3INPbRkcI8a/Owo0XbiTNH19wg==" + "version": "3.1.25", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.25.tgz", + "integrity": "sha512-rdwtIXaXCLFAQbnfqDRnI6jaRHp9fTcYBjtFKE8eezcZ7LuLjhUaQGNeMXf1HmRoCH32CLz6XwX0TtxEOS/A3Q==" }, "nanomatch": { "version": "1.2.13", @@ -36531,25 +36511,36 @@ } }, "react-native-reanimated": { - "version": "2.3.0-beta.3", - "resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-2.3.0-beta.3.tgz", - "integrity": "sha512-gIcaBte910Yzre8krVATYsdIq96WFNnKY7dRGSobfcaUttRy+wQu7mvYk502BG3MU1CGh5pI1r31nh3LfdIMhg==", + "version": "2.3.0-alpha.1", + "resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-2.3.0-alpha.1.tgz", + "integrity": "sha512-6FTQ6wkKxNwQS3IumJnF8pE2OxMcIKI/cLoHPq4PuN5f6vsSvZ3zNzzNOSRHZSVV/Gg9FCNt05gXvFNRrGdGig==", "requires": { "@babel/plugin-transform-object-assign": "^7.10.4", - "@types/invariant": "^2.2.35", - "invariant": "^2.2.4", - "lodash.isequal": "^4.5.0", + "fbjs": "^3.0.0", "mockdate": "^3.0.2", - "react-native-screens": "^3.4.0", "string-hash-64": "^1.0.3" }, "dependencies": { - "react-native-screens": { - "version": "3.8.0", - "resolved": "https://registry.npmjs.org/react-native-screens/-/react-native-screens-3.8.0.tgz", - "integrity": "sha512-lHrnB/elAoMJKv8O12U6BLgeup4lB6ZKJHEOVuG/D72nv/OE9wUusbou6YCB5tp3YbaSpHflPnkFmHA/vCejpw==", + "fbjs": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/fbjs/-/fbjs-3.0.0.tgz", + "integrity": "sha512-dJd4PiDOFuhe7vk4F80Mba83Vr2QuK86FoxtgPmzBqEJahncp+13YCmfoa53KHCo6OnlXLG7eeMWPfB5CrpVKg==", "requires": { - "warn-once": "^0.1.0" + "cross-fetch": "^3.0.4", + "fbjs-css-vars": "^1.0.0", + "loose-envify": "^1.0.0", + "object-assign": "^4.1.0", + "promise": "^7.1.1", + "setimmediate": "^1.0.5", + "ua-parser-js": "^0.7.18" + } + }, + "promise": { + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz", + "integrity": "sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg==", + "requires": { + "asap": "~2.0.3" } } } diff --git a/package.json b/package.json index 3a4d0abc0831..14b145167900 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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", diff --git a/src/libs/Navigation/AppNavigator/DrawerNavigator/BaseDrawerNavigator.js b/src/libs/Navigation/AppNavigator/BaseDrawerNavigator.js similarity index 63% rename from src/libs/Navigation/AppNavigator/DrawerNavigator/BaseDrawerNavigator.js rename to src/libs/Navigation/AppNavigator/BaseDrawerNavigator.js index 0e0c6164e748..22cfee6d250b 100644 --- a/src/libs/Navigation/AppNavigator/DrawerNavigator/BaseDrawerNavigator.js +++ b/src/libs/Navigation/AppNavigator/BaseDrawerNavigator.js @@ -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 = ( { BaseDrawerNavigator.propTypes = propTypes; BaseDrawerNavigator.displayName = 'BaseDrawerNavigator'; -export default BaseDrawerNavigator; +export default withWindowDimensions(BaseDrawerNavigator); diff --git a/src/libs/Navigation/AppNavigator/DrawerNavigator/drawerNavigatorPropTypes.js b/src/libs/Navigation/AppNavigator/DrawerNavigator/drawerNavigatorPropTypes.js deleted file mode 100644 index dc7a02641b97..000000000000 --- a/src/libs/Navigation/AppNavigator/DrawerNavigator/drawerNavigatorPropTypes.js +++ /dev/null @@ -1,28 +0,0 @@ -import PropTypes from 'prop-types'; -import {windowDimensionsPropTypes} from '../../../../components/withWindowDimensions'; - -const propTypes = { - /** Screens to be passed in the Drawer */ - screens: PropTypes.arrayOf(PropTypes.shape({ - /** Name of the Screen */ - name: PropTypes.string.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, -}; - -export default propTypes; diff --git a/src/libs/Navigation/AppNavigator/DrawerNavigator/index.js b/src/libs/Navigation/AppNavigator/DrawerNavigator/index.js deleted file mode 100644 index 1de68d08fca5..000000000000 --- a/src/libs/Navigation/AppNavigator/DrawerNavigator/index.js +++ /dev/null @@ -1,20 +0,0 @@ -import React from 'react'; -import withWindowDimensions from '../../../../components/withWindowDimensions'; -import BaseDrawerNavigator from './BaseDrawerNavigator'; -import propTypes from './drawerNavigatorPropTypes'; - -const DrawerNavigator = props => ( - -); - -DrawerNavigator.propTypes = propTypes; -DrawerNavigator.displayName = 'DrawerNavigator'; -export default withWindowDimensions(DrawerNavigator); diff --git a/src/libs/Navigation/AppNavigator/DrawerNavigator/index.native.js b/src/libs/Navigation/AppNavigator/DrawerNavigator/index.native.js deleted file mode 100644 index 4c45e3e85bbc..000000000000 --- a/src/libs/Navigation/AppNavigator/DrawerNavigator/index.native.js +++ /dev/null @@ -1,16 +0,0 @@ -import React from 'react'; -import withWindowDimensions from '../../../../components/withWindowDimensions'; -import BaseDrawerNavigator from './BaseDrawerNavigator'; -import propTypes from './drawerNavigatorPropTypes'; - -const DrawerNavigator = props => ( - -); - -DrawerNavigator.propTypes = propTypes; -DrawerNavigator.displayName = 'DrawerNavigator'; -export default withWindowDimensions(DrawerNavigator); diff --git a/src/libs/Navigation/AppNavigator/MainDrawerNavigator.js b/src/libs/Navigation/AppNavigator/MainDrawerNavigator.js index 3fa7cd9c67da..7671baa96809 100644 --- a/src/libs/Navigation/AppNavigator/MainDrawerNavigator.js +++ b/src/libs/Navigation/AppNavigator/MainDrawerNavigator.js @@ -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 = { @@ -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 ( - } screens={[ { diff --git a/src/libs/Navigation/CustomActions.js b/src/libs/Navigation/CustomActions.js index 00bc48ba5c05..2770d81a7963 100644 --- a/src/libs/Navigation/CustomActions.js +++ b/src/libs/Navigation/CustomActions.js @@ -59,26 +59,23 @@ function pushDrawerRoute(screenName, params, navigationRef) { const rootState = navigationRef.current.getRootState(); const activeReportID = lodashGet(rootState, 'routes[0].state.routes[0].params.reportID', ''); - if (state.type !== 'drawer') { - if (activeReportID === params.reportID) { + if (activeReportID === params.reportID) { + if (state.type !== 'drawer') { navigateBackToRootDrawer(navigationRef); - } else { - // Non Drawer navigators have routes and not history so we'll fallback to navigate() in the case where we are - // unable to push a new screen onto the history stack e.g. navigating to a ReportScreen via a modal screen. - // Note: One downside of this is that the history will be reset. - navigationRef.current.dispatch(() => CommonActions.navigate(screenName, params)); } return DrawerActions.closeDrawer(); } - const screenRoute = {type: 'route', name: screenName}; - const history = _.map([...(state.history || [screenRoute])], () => screenRoute); + // Non Drawer navigators have routes and not history so we'll fallback to navigate() in the case where we are + // unable to push a new screen onto the history stack e.g. navigating to a ReportScreen via a modal screen. + // Note: One downside of this is that the history will be reset. + if (state.type !== 'drawer') { + return CommonActions.navigate(screenName, params); + } - // Force drawer to close and show the report screen - history.push({ - type: 'drawer', - status: 'closed', - }); + const screenRoute = {type: 'route', name: screenName}; + const history = _.map([...(state.history || [])], () => screenRoute); + history.push(screenRoute); return CommonActions.reset({ ...state, routes: [{