diff --git a/android/app/build.gradle b/android/app/build.gradle
index bcac489f6828..afe24fc37700 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -90,8 +90,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
- versionCode 1001037402
- versionName "1.3.74-2"
+ versionCode 1001037403
+ versionName "1.3.74-3"
}
flavorDimensions "default"
diff --git a/docs/articles/expensify-classic/get-paid-back/reports/Reimbursements.md b/docs/articles/expensify-classic/get-paid-back/reports/Reimbursements.md
index c2cc25b32373..a31c0a582fd7 100644
--- a/docs/articles/expensify-classic/get-paid-back/reports/Reimbursements.md
+++ b/docs/articles/expensify-classic/get-paid-back/reports/Reimbursements.md
@@ -1,5 +1,42 @@
----
-title: Reimbursements
-description: Reimbursements
----
-## Resource Coming Soon!
+# Overview
+
+If you want to know more about how and when you’ll be reimbursed through Expensify, we’ve answered your questions below.
+
+# How to Get Reimbursed
+
+To get paid back after submitting a report for reimbursement, you’ll want to be sure to connect your bank account. You can do that under **Settings** > **Account** > **Payments** > **Add a Deposit Account**. Once your employer has approved your report, the reimbursement will be paid into the account you added.
+
+# Deep Dive
+
+## Reimbursement Timing
+
+### US Bank Accounts
+
+If your company uses Expensify's ACH reimbursement we'll first check to see if the report is eligible for Rapid Reimbursement (next business day). For a report to be eligible for Rapid Reimbursement it must fall under two limits:
+
+ - $100 per deposit bank account per day or less for the individuals being reimbursed or businesses receiving payments for bills.
+ - Less than $10,000 being disbursed in a 24-hour time period from the verified bank account being used to pay the reimbursement.
+
+If the request passes both checks, then you can expect to see funds deposited into your bank account on the next business day.
+
+If either limit has been reached, then you can expect to see funds deposited within your bank account within the typical ACH timeframe of 3-5 business days.
+
+### International Bank Accounts
+
+If receiving reimbursement to an international deposit account via Global Reimbursement, you should expect to see funds deposited in your bank account within 4 business days.
+
+## Bank Processing Timeframes
+
+Banks only process transactions and ACH activity on weekdays that are not bank holidays. These are considered business days. Additionally, the business day on which a transaction will be processed depends upon whether or not a request is created before or after the cutoff time, which is typically 3 pm PST.
+For example, if your reimbursement is initiated at 4 pm on Wednesday, this is past the bank's cutoff time, and it will not begin processing until the next business day.
+If that same reimbursement starts processing on Thursday, and it's estimated to take 3-5 business days, this will cover a weekend, and both days are not considered business days. So, assuming there are no bank holidays added into this mix, here is how that reimbursement timeline would play out:
+
+**Wednesday**: Reimbursement initiated after 3 pm PST; will be processed the next business day by your company’s bank.
+**Thursday**: Your company's bank will begin processing the withdrawal request
+**Friday**: Business day 1
+**Saturday**: Weekend
+**Sunday**: Weekend
+**Monday**: Business day 2
+**Tuesday**: Business day 3
+**Wednesday**: Business day 4
+**Thursday**: Business day 5
diff --git a/ios/NewExpensify/Info.plist b/ios/NewExpensify/Info.plist
index f41740a8bcb2..73e22053eda1 100644
--- a/ios/NewExpensify/Info.plist
+++ b/ios/NewExpensify/Info.plist
@@ -40,7 +40,7 @@
CFBundleVersion
- 1.3.74.2
+ 1.3.74.3
ITSAppUsesNonExemptEncryption
LSApplicationQueriesSchemes
diff --git a/ios/NewExpensifyTests/Info.plist b/ios/NewExpensifyTests/Info.plist
index 95714ea2cc9f..5e7f02699579 100644
--- a/ios/NewExpensifyTests/Info.plist
+++ b/ios/NewExpensifyTests/Info.plist
@@ -19,6 +19,6 @@
CFBundleSignature
????
CFBundleVersion
- 1.3.74.2
+ 1.3.74.3
diff --git a/package-lock.json b/package-lock.json
index 64ee3cf6308f..d8cba15c32af 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "new.expensify",
- "version": "1.3.74-2",
+ "version": "1.3.74-3",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "new.expensify",
- "version": "1.3.74-2",
+ "version": "1.3.74-3",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {
diff --git a/package.json b/package.json
index cd93f718679e..24fdeaaed66d 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "new.expensify",
- "version": "1.3.74-2",
+ "version": "1.3.74-3",
"author": "Expensify, Inc.",
"homepage": "https://new.expensify.com",
"description": "New Expensify is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.",
diff --git a/src/CONST.ts b/src/CONST.ts
index e487514f150e..4f34e7cb2136 100755
--- a/src/CONST.ts
+++ b/src/CONST.ts
@@ -1369,6 +1369,7 @@ const CONST = {
MERCHANT: 'merchant',
CATEGORY: 'category',
RECEIPT: 'receipt',
+ DISTANCE: 'distance',
TAG: 'tag',
},
FOOTER: {
diff --git a/src/ROUTES.ts b/src/ROUTES.ts
index 78d5f4d54888..00f3a4012664 100644
--- a/src/ROUTES.ts
+++ b/src/ROUTES.ts
@@ -5,19 +5,18 @@ import CONST from './CONST';
* This is a file containing constants for all of the routes we want to be able to go to
*/
-// prettier-ignore
export default {
HOME: '',
/** This is a utility route used to go to the user's concierge chat, or the sign-in page if the user's not authenticated */
CONCIERGE: 'concierge',
FLAG_COMMENT: {
route: 'flag/:reportID/:reportActionID',
- getRoute: (reportID: string, reportActionID: string) => `flag/${reportID}/${reportActionID}`
+ getRoute: (reportID: string, reportActionID: string) => `flag/${reportID}/${reportActionID}`,
},
SEARCH: 'search',
DETAILS: {
route: 'details',
- getRoute: (login: string) => `details?login=${encodeURIComponent(login)}`
+ getRoute: (login: string) => `details?login=${encodeURIComponent(login)}`,
},
PROFILE: {
route: 'a/:accountID',
@@ -31,7 +30,7 @@ export default {
VALIDATE_LOGIN: 'v/:accountID/:validateCode',
GET_ASSISTANCE: {
route: 'get-assistance/:taskID',
- getRoute: (taskID: string) => `get-assistance/${taskID}`
+ getRoute: (taskID: string) => `get-assistance/${taskID}`,
},
UNLINK_LOGIN: 'u/:accountID/:validateCode',
APPLE_SIGN_IN: 'sign-in-with-apple',
@@ -102,11 +101,11 @@ export default {
REPORT: 'r',
REPORT_WITH_ID: {
route: 'r/:reportID?/:reportActionID?',
- getRoute: (reportID: string) => `r/${reportID}`
+ getRoute: (reportID: string) => `r/${reportID}`,
},
EDIT_REQUEST: {
route: 'r/:threadReportID/edit/:field',
- getRoute: (threadReportID: string, field: ValueOf) => `r/${threadReportID}/edit/${field}`
+ getRoute: (threadReportID: string, field: ValueOf) => `r/${threadReportID}/edit/${field}`,
},
EDIT_CURRENCY_REQUEST: {
route: 'r/:threadReportID/edit/currency',
@@ -114,89 +113,89 @@ export default {
},
REPORT_WITH_ID_DETAILS_SHARE_CODE: {
route: 'r/:reportID/details/shareCode',
- getRoute: (reportID: string) => `r/${reportID}/details/shareCode`
+ getRoute: (reportID: string) => `r/${reportID}/details/shareCode`,
},
REPORT_ATTACHMENTS: {
route: 'r/:reportID/attachment',
- getRoute: (reportID: string, source: string) => `r/${reportID}/attachment?source=${encodeURI(source)}`
+ getRoute: (reportID: string, source: string) => `r/${reportID}/attachment?source=${encodeURI(source)}`,
},
REPORT_PARTICIPANTS: {
route: 'r/:reportID/participants',
- getRoute: (reportID: string) => `r/${reportID}/participants`
+ getRoute: (reportID: string) => `r/${reportID}/participants`,
},
REPORT_WITH_ID_DETAILS: {
route: 'r/:reportID/details',
- getRoute: (reportID: string) => `r/${reportID}/details`
+ getRoute: (reportID: string) => `r/${reportID}/details`,
},
REPORT_SETTINGS: {
route: 'r/:reportID/settings',
- getRoute: (reportID: string) => `r/${reportID}/settings`
+ getRoute: (reportID: string) => `r/${reportID}/settings`,
},
REPORT_SETTINGS_ROOM_NAME: {
route: 'r/:reportID/settings/room-name',
- getRoute: (reportID: string) => `r/${reportID}/settings/room-name`
+ getRoute: (reportID: string) => `r/${reportID}/settings/room-name`,
},
REPORT_SETTINGS_NOTIFICATION_PREFERENCES: {
route: 'r/:reportID/settings/notification-preferences',
- getRoute: (reportID: string) => `r/${reportID}/settings/notification-preferences`
+ getRoute: (reportID: string) => `r/${reportID}/settings/notification-preferences`,
},
REPORT_SETTINGS_WRITE_CAPABILITY: {
route: 'r/:reportID/settings/who-can-post',
- getRoute: (reportID: string) => `r/${reportID}/settings/who-can-post`
+ getRoute: (reportID: string) => `r/${reportID}/settings/who-can-post`,
},
REPORT_WELCOME_MESSAGE: {
route: 'r/:reportID/welcomeMessage',
- getRoute: (reportID: string) => `r/${reportID}/welcomeMessage`
+ getRoute: (reportID: string) => `r/${reportID}/welcomeMessage`,
},
SPLIT_BILL_DETAILS: {
route: 'r/:reportID/split/:reportActionID',
- getRoute: (reportID: string, reportActionID: string) => `r/${reportID}/split/${reportActionID}`
+ getRoute: (reportID: string, reportActionID: string) => `r/${reportID}/split/${reportActionID}`,
},
TASK_TITLE: {
route: 'r/:reportID/title',
- getRoute: (reportID: string) => `r/${reportID}/title`
+ getRoute: (reportID: string) => `r/${reportID}/title`,
},
TASK_DESCRIPTION: {
route: 'r/:reportID/description',
- getRoute: (reportID: string) => `r/${reportID}/description`
+ getRoute: (reportID: string) => `r/${reportID}/description`,
},
TASK_ASSIGNEE: {
route: 'r/:reportID/assignee',
- getRoute: (reportID: string) => `r/${reportID}/assignee`
+ getRoute: (reportID: string) => `r/${reportID}/assignee`,
},
PRIVATE_NOTES_VIEW: {
route: 'r/:reportID/notes/:accountID',
- getRoute: (reportID: string, accountID: string | number) => `r/${reportID}/notes/${accountID}`
+ getRoute: (reportID: string, accountID: string | number) => `r/${reportID}/notes/${accountID}`,
},
PRIVATE_NOTES_LIST: {
route: 'r/:reportID/notes',
- getRoute: (reportID: string) => `r/${reportID}/notes`
+ getRoute: (reportID: string) => `r/${reportID}/notes`,
},
PRIVATE_NOTES_EDIT: {
route: 'r/:reportID/notes/:accountID/edit',
- getRoute: (reportID: string, accountID: string | number) => `r/${reportID}/notes/${accountID}/edit`
+ getRoute: (reportID: string, accountID: string | number) => `r/${reportID}/notes/${accountID}/edit`,
},
// To see the available iouType, please refer to CONST.IOU.MONEY_REQUEST_TYPE
MONEY_REQUEST: {
route: ':iouType/new/:reportID?',
- getRoute: (iouType: string, reportID = '') => `${iouType}/new/${reportID}`
+ getRoute: (iouType: string, reportID = '') => `${iouType}/new/${reportID}`,
},
MONEY_REQUEST_AMOUNT: {
route: ':iouType/new/amount/:reportID?',
- getRoute: (iouType: string, reportID = '') => `${iouType}/new/amount/${reportID}`
+ getRoute: (iouType: string, reportID = '') => `${iouType}/new/amount/${reportID}`,
},
MONEY_REQUEST_PARTICIPANTS: {
route: ':iouType/new/participants/:reportID?',
- getRoute: (iouType: string, reportID = '') => `${iouType}/new/participants/${reportID}`
+ getRoute: (iouType: string, reportID = '') => `${iouType}/new/participants/${reportID}`,
},
MONEY_REQUEST_CONFIRMATION: {
route: ':iouType/new/confirmation/:reportID?',
- getRoute: (iouType: string, reportID = '') => `${iouType}/new/confirmation/${reportID}`
+ getRoute: (iouType: string, reportID = '') => `${iouType}/new/confirmation/${reportID}`,
},
MONEY_REQUEST_DATE: {
route: ':iouType/new/date/:reportID?',
- getRoute: (iouType: string, reportID = '') => `${iouType}/new/date/${reportID}`
+ getRoute: (iouType: string, reportID = '') => `${iouType}/new/date/${reportID}`,
},
MONEY_REQUEST_CURRENCY: {
route: ':iouType/new/currency/:reportID?',
@@ -204,35 +203,39 @@ export default {
},
MONEY_REQUEST_DESCRIPTION: {
route: ':iouType/new/description/:reportID?',
- getRoute: (iouType: string, reportID = '') => `${iouType}/new/description/${reportID}`
+ getRoute: (iouType: string, reportID = '') => `${iouType}/new/description/${reportID}`,
},
MONEY_REQUEST_CATEGORY: {
route: ':iouType/new/category/:reportID?',
- getRoute: (iouType: string, reportID = '') => `${iouType}/new/category/${reportID}`
+ getRoute: (iouType: string, reportID = '') => `${iouType}/new/category/${reportID}`,
},
MONEY_REQUEST_TAG: {
route: ':iouType/new/tag/:reportID?',
- getRoute: (iouType: string, reportID = '') => `${iouType}/new/tag/${reportID}`
+ getRoute: (iouType: string, reportID = '') => `${iouType}/new/tag/${reportID}`,
},
MONEY_REQUEST_MERCHANT: {
route: ':iouType/new/merchant/:reportID?',
- getRoute: (iouType: string, reportID = '') => `${iouType}/new/merchant/${reportID}`
+ getRoute: (iouType: string, reportID = '') => `${iouType}/new/merchant/${reportID}`,
},
MONEY_REQUEST_WAYPOINT: {
route: ':iouType/new/waypoint/:waypointIndex',
- getRoute: (iouType: string, waypointIndex: number) => `${iouType}/new/waypoint/${waypointIndex}`
+ getRoute: (iouType: string, waypointIndex: number) => `${iouType}/new/waypoint/${waypointIndex}`,
},
MONEY_REQUEST_RECEIPT: {
route: ':iouType/new/receipt/:reportID?',
- getRoute: (iouType: string, reportID = '') => `${iouType}/new/receipt/${reportID}`
+ getRoute: (iouType: string, reportID = '') => `${iouType}/new/receipt/${reportID}`,
},
- MONEY_REQUEST_ADDRESS: {
+ MONEY_REQUEST_DISTANCE: {
route: ':iouType/new/address/:reportID?',
- getRoute: (iouType: string, reportID = '') => `${iouType}/new/address/${reportID}`
+ getRoute: (iouType: string, reportID = '') => `${iouType}/new/address/${reportID}`,
+ },
+ MONEY_REQUEST_EDIT_WAYPOINT: {
+ route: 'r/:threadReportID/edit/distance/:transactionID/waypoint/:waypointIndex',
+ getRoute: (threadReportID: number, transactionID: string, waypointIndex: number) => `r/${threadReportID}/edit/distance/${transactionID}/waypoint/${waypointIndex}`,
},
MONEY_REQUEST_DISTANCE_TAB: {
route: ':iouType/new/:reportID?/distance',
- getRoute: (iouType: string, reportID = '') => `${iouType}/new/${reportID}/distance`
+ getRoute: (iouType: string, reportID = '') => `${iouType}/new/${reportID}/distance`,
},
MONEY_REQUEST_MANUAL_TAB: ':iouType/new/:reportID?/manual',
MONEY_REQUEST_SCAN_TAB: ':iouType/new/:reportID?/scan',
@@ -259,47 +262,47 @@ export default {
WORKSPACE_NEW_ROOM: 'workspace/new-room',
WORKSPACE_INITIAL: {
route: 'workspace/:policyID',
- getRoute: (policyID: string) => `workspace/${policyID}`
+ getRoute: (policyID: string) => `workspace/${policyID}`,
},
WORKSPACE_INVITE: {
route: 'workspace/:policyID/invite',
- getRoute: (policyID: string) => `workspace/${policyID}/invite`
+ getRoute: (policyID: string) => `workspace/${policyID}/invite`,
},
WORKSPACE_INVITE_MESSAGE: {
route: 'workspace/:policyID/invite-message',
- getRoute: (policyID: string) => `workspace/${policyID}/invite-message`
+ getRoute: (policyID: string) => `workspace/${policyID}/invite-message`,
},
WORKSPACE_SETTINGS: {
route: 'workspace/:policyID/settings',
- getRoute: (policyID: string) => `workspace/${policyID}/settings`
+ getRoute: (policyID: string) => `workspace/${policyID}/settings`,
},
WORKSPACE_CARD: {
route: 'workspace/:policyID/card',
- getRoute: (policyID: string) => `workspace/${policyID}/card`
+ getRoute: (policyID: string) => `workspace/${policyID}/card`,
},
WORKSPACE_REIMBURSE: {
route: 'workspace/:policyID/reimburse',
- getRoute: (policyID: string) => `workspace/${policyID}/reimburse`
+ getRoute: (policyID: string) => `workspace/${policyID}/reimburse`,
},
WORKSPACE_RATE_AND_UNIT: {
route: 'workspace/:policyID/rateandunit',
- getRoute: (policyID: string) => `workspace/${policyID}/rateandunit`
+ getRoute: (policyID: string) => `workspace/${policyID}/rateandunit`,
},
WORKSPACE_BILLS: {
route: 'workspace/:policyID/bills',
- getRoute: (policyID: string) => `workspace/${policyID}/bills`
+ getRoute: (policyID: string) => `workspace/${policyID}/bills`,
},
WORKSPACE_INVOICES: {
route: 'workspace/:policyID/invoices',
- getRoute: (policyID: string) => `workspace/${policyID}/invoices`
+ getRoute: (policyID: string) => `workspace/${policyID}/invoices`,
},
WORKSPACE_TRAVEL: {
route: 'workspace/:policyID/travel',
- getRoute: (policyID: string) => `workspace/${policyID}/travel`
+ getRoute: (policyID: string) => `workspace/${policyID}/travel`,
},
WORKSPACE_MEMBERS: {
route: 'workspace/:policyID/members',
- getRoute: (policyID: string) => `workspace/${policyID}/members`
+ getRoute: (policyID: string) => `workspace/${policyID}/members`,
},
// These are some on-off routes that will be removed once they're no longer needed (see GH issues for details)
diff --git a/src/components/DistanceRequest.js b/src/components/DistanceRequest.js
index 5e9b73f2eb3a..30e5adfc62b0 100644
--- a/src/components/DistanceRequest.js
+++ b/src/components/DistanceRequest.js
@@ -5,39 +5,31 @@ import lodashGet from 'lodash/get';
import lodashIsNil from 'lodash/isNil';
import PropTypes from 'prop-types';
import _ from 'underscore';
-
import CONST from '../CONST';
import ROUTES from '../ROUTES';
import ONYXKEYS from '../ONYXKEYS';
-
import styles from '../styles/styles';
import variables from '../styles/variables';
-import theme from '../styles/themes/default';
-
-import transactionPropTypes from './transactionPropTypes';
-
+import LinearGradient from './LinearGradient';
+import * as MapboxToken from '../libs/actions/MapboxToken';
import useNetwork from '../hooks/useNetwork';
-import usePrevious from '../hooks/usePrevious';
import useLocalize from '../hooks/useLocalize';
-
-import * as ErrorUtils from '../libs/ErrorUtils';
import Navigation from '../libs/Navigation/Navigation';
-import * as MapboxToken from '../libs/actions/MapboxToken';
+import reportPropTypes from '../pages/reportPropTypes';
+import DotIndicatorMessage from './DotIndicatorMessage';
+import * as ErrorUtils from '../libs/ErrorUtils';
+import usePrevious from '../hooks/usePrevious';
+import theme from '../styles/themes/default';
import * as Transaction from '../libs/actions/Transaction';
import * as TransactionUtils from '../libs/TransactionUtils';
import * as IOUUtils from '../libs/IOUUtils';
-
import Button from './Button';
import DistanceMapView from './DistanceMapView';
-import LinearGradient from './LinearGradient';
import * as Expensicons from './Icon/Expensicons';
import PendingMapView from './MapView/PendingMapView';
-import DotIndicatorMessage from './DotIndicatorMessage';
import MenuItemWithTopDescription from './MenuItemWithTopDescription';
-import {iouPropTypes} from '../pages/iou/propTypes';
-import reportPropTypes from '../pages/reportPropTypes';
-import * as IOU from '../libs/actions/IOU';
import * as StyleUtils from '../styles/StyleUtils';
+import transactionPropTypes from './transactionPropTypes';
import ScreenWrapper from './ScreenWrapper';
import FullPageNotFoundView from './BlockingViews/FullPageNotFoundView';
import HeaderWithBackButton from './HeaderWithBackButton';
@@ -46,18 +38,12 @@ const MAX_WAYPOINTS = 25;
const MAX_WAYPOINTS_TO_DISPLAY = 4;
const propTypes = {
- /** Holds data related to Money Request view state, rather than the underlying Money Request data. */
- iou: iouPropTypes,
-
- /** Type of money request (i.e. IOU) */
- iouType: PropTypes.oneOf(_.values(CONST.IOU.MONEY_REQUEST_TYPE)),
+ /** The transactionID of this request */
+ transactionID: PropTypes.string,
/** The report to which the distance request is associated */
report: reportPropTypes,
- /** The optimistic transaction for this request */
- transaction: transactionPropTypes,
-
/** Data about Mapbox token for calling Mapbox API */
mapboxAccessToken: PropTypes.shape({
/** Temporary token for Mapbox API */
@@ -67,6 +53,15 @@ const propTypes = {
expiration: PropTypes.string,
}),
+ /** Are we editing an existing distance request, or creating a new one? */
+ isEditingRequest: PropTypes.bool,
+
+ /** Called on submit of this page */
+ onSubmit: PropTypes.func.isRequired,
+
+ /* Onyx Props */
+ transaction: transactionPropTypes,
+
/** React Navigation route */
route: PropTypes.shape({
/** Params from the route */
@@ -81,16 +76,16 @@ const propTypes = {
};
const defaultProps = {
- iou: {},
- iouType: '',
+ transactionID: '',
report: {},
- transaction: {},
+ isEditingRequest: false,
mapboxAccessToken: {
token: '',
},
+ transaction: {},
};
-function DistanceRequest({iou, iouType, report, transaction, mapboxAccessToken, route}) {
+function DistanceRequest({transactionID, report, transaction, mapboxAccessToken, route, isEditingRequest, onSubmit}) {
const [shouldShowGradient, setShouldShowGradient] = useState(false);
const [scrollContainerHeight, setScrollContainerHeight] = useState(0);
const [scrollContentHeight, setScrollContentHeight] = useState(0);
@@ -99,6 +94,7 @@ function DistanceRequest({iou, iouType, report, transaction, mapboxAccessToken,
const isEditing = lodashGet(route, 'path', '').includes('address');
const reportID = lodashGet(report, 'reportID', '');
+ const iouType = lodashGet(route, 'params.iouType', '');
const waypoints = useMemo(() => lodashGet(transaction, 'comment.waypoints', {}), [transaction]);
const previousWaypoints = usePrevious(waypoints);
const numberOfWaypoints = _.size(waypoints);
@@ -107,6 +103,7 @@ function DistanceRequest({iou, iouType, report, transaction, mapboxAccessToken,
const lastWaypointIndex = numberOfWaypoints - 1;
const isLoadingRoute = lodashGet(transaction, 'comment.isLoading', false);
+ const isLoading = lodashGet(transaction, 'isLoading', false);
const hasRouteError = !!lodashGet(transaction, 'errorFields.route');
const hasRoute = TransactionUtils.hasRoute(transaction);
const validatedWaypoints = TransactionUtils.getValidWaypoints(waypoints);
@@ -159,12 +156,12 @@ function DistanceRequest({iou, iouType, report, transaction, mapboxAccessToken,
}, []);
useEffect(() => {
- if (!iou.transactionID || !_.isEmpty(waypoints)) {
+ if (!transactionID || !_.isEmpty(waypoints)) {
return;
}
// Create the initial start and stop waypoints
- Transaction.createInitialWaypoints(iou.transactionID);
- }, [iou.transactionID, waypoints]);
+ Transaction.createInitialWaypoints(transactionID);
+ }, [transactionID, waypoints]);
const updateGradientVisibility = (event = {}) => {
// If a waypoint extends past the bottom of the visible area show the gradient, else hide it.
@@ -176,8 +173,8 @@ function DistanceRequest({iou, iouType, report, transaction, mapboxAccessToken,
return;
}
- Transaction.getRoute(iou.transactionID, validatedWaypoints);
- }, [shouldFetchRoute, iou.transactionID, validatedWaypoints, isOffline]);
+ Transaction.getRoute(transactionID, validatedWaypoints);
+ }, [shouldFetchRoute, transactionID, validatedWaypoints, isOffline]);
useEffect(() => {
if (numberOfWaypoints <= numberOfPreviousWaypoints) {
@@ -192,13 +189,12 @@ function DistanceRequest({iou, iouType, report, transaction, mapboxAccessToken,
Navigation.goBack(isEditing ? ROUTES.MONEY_REQUEST_CONFIRMATION.getRoute(iouType, reportID) : ROUTES.HOME);
};
- const navigateToNextPage = () => {
- if (isEditing) {
- Navigation.goBack(ROUTES.MONEY_REQUEST_CONFIRMATION.getRoute(iouType, reportID));
- return;
- }
-
- IOU.navigateToNextPage(iou, iouType, reportID, report);
+ /**
+ * Takes the user to the page for editing a specific waypoint
+ * @param {Number} index of the waypoint to edit
+ */
+ const navigateToWaypointEditPage = (index) => {
+ Navigation.navigate(isEditingRequest ? ROUTES.MONEY_REQUEST_EDIT_WAYPOINT.getRoute(report.reportID, transactionID, index) : ROUTES.MONEY_REQUEST_WAYPOINT.getRoute('request', index));
};
const content = (
@@ -237,7 +233,7 @@ function DistanceRequest({iou, iouType, report, transaction, mapboxAccessToken,
secondaryIcon={waypointIcon}
secondaryIconFill={theme.icon}
shouldShowRightIcon
- onPress={() => Navigation.navigate(ROUTES.MONEY_REQUEST_WAYPOINT.getRoute('request', index))}
+ onPress={() => navigateToWaypointEditPage(index)}
key={key}
/>
);
@@ -261,10 +257,7 @@ function DistanceRequest({iou, iouType, report, transaction, mapboxAccessToken,