From f462336d30d526eac1265f4a102add8190f96b62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Wed, 2 Aug 2023 10:04:27 +0200 Subject: [PATCH 01/13] Update onyx --- package-lock.json | 14 +++++++------- package.json | 2 +- src/libs/actions/QueuedOnyxUpdates.js | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index c4ddae6fdc24..c259d7ad1d18 100644 --- a/package-lock.json +++ b/package-lock.json @@ -79,7 +79,7 @@ "react-native-key-command": "^1.0.1", "react-native-localize": "^2.2.6", "react-native-modal": "^13.0.0", - "react-native-onyx": "1.0.52", + "react-native-onyx": "1.0.56", "react-native-pdf": "^6.6.2", "react-native-performance": "^4.0.0", "react-native-permissions": "^3.0.1", @@ -37435,9 +37435,9 @@ } }, "node_modules/react-native-onyx": { - "version": "1.0.52", - "resolved": "https://registry.npmjs.org/react-native-onyx/-/react-native-onyx-1.0.52.tgz", - "integrity": "sha512-lfIg+tSd+HZF00pr2oFoLY3iTdGYGC6Dd44/YktTsVKB/yIcUq61wBMOitX54Z54ac2/eHKFPicEr2xvBhE2VQ==", + "version": "1.0.56", + "resolved": "https://registry.npmjs.org/react-native-onyx/-/react-native-onyx-1.0.56.tgz", + "integrity": "sha512-6KHwCwCgTtgZ2gGgCFxbJRRL4e2tamCjdbb9ca0jDCUgxZ6NQkEkVhZLaFCPwQn1dX7zonbdbaciFjlUxyOVFQ==", "dependencies": { "ascii-table": "0.0.9", "fast-equals": "^4.0.3", @@ -69733,9 +69733,9 @@ } }, "react-native-onyx": { - "version": "1.0.52", - "resolved": "https://registry.npmjs.org/react-native-onyx/-/react-native-onyx-1.0.52.tgz", - "integrity": "sha512-lfIg+tSd+HZF00pr2oFoLY3iTdGYGC6Dd44/YktTsVKB/yIcUq61wBMOitX54Z54ac2/eHKFPicEr2xvBhE2VQ==", + "version": "1.0.56", + "resolved": "https://registry.npmjs.org/react-native-onyx/-/react-native-onyx-1.0.56.tgz", + "integrity": "sha512-6KHwCwCgTtgZ2gGgCFxbJRRL4e2tamCjdbb9ca0jDCUgxZ6NQkEkVhZLaFCPwQn1dX7zonbdbaciFjlUxyOVFQ==", "requires": { "ascii-table": "0.0.9", "fast-equals": "^4.0.3", diff --git a/package.json b/package.json index 70f600ccf2ef..fda5c1c59f56 100644 --- a/package.json +++ b/package.json @@ -118,7 +118,7 @@ "react-native-key-command": "^1.0.1", "react-native-localize": "^2.2.6", "react-native-modal": "^13.0.0", - "react-native-onyx": "1.0.52", + "react-native-onyx": "1.0.56", "react-native-pdf": "^6.6.2", "react-native-performance": "^4.0.0", "react-native-permissions": "^3.0.1", diff --git a/src/libs/actions/QueuedOnyxUpdates.js b/src/libs/actions/QueuedOnyxUpdates.js index d25f44a9aa60..486108dd56cf 100644 --- a/src/libs/actions/QueuedOnyxUpdates.js +++ b/src/libs/actions/QueuedOnyxUpdates.js @@ -14,7 +14,7 @@ Onyx.connect({ * @returns {Promise} */ function queueOnyxUpdates(updates) { - return Onyx.merge(ONYXKEYS.QUEUED_ONYX_UPDATES, updates); + return Onyx.set(ONYXKEYS.QUEUED_ONYX_UPDATES, [...queuedOnyxUpdates, ...updates]); } function clear() { From 8558d74c0d617f1340a9ecb7f647de7539fdf7c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Wed, 2 Aug 2023 10:20:13 +0200 Subject: [PATCH 02/13] fix resetting IOU on new request https://github.com/Expensify/App/issues/23973 --- src/libs/actions/IOU.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index 5660bc31a880..f0905eca0a89 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -60,9 +60,10 @@ Onyx.connect({ /** * Reset money request info from the store with its initial value * @param {String} id + * @returns {Promise} */ function resetMoneyRequestInfo(id = '') { - Onyx.merge(ONYXKEYS.IOU, { + return Onyx.merge(ONYXKEYS.IOU, { id, amount: 0, currency: lodashGet(currentUserPersonalDetails, 'localCurrencyCode', CONST.CURRENCY.USD), @@ -1439,8 +1440,9 @@ function payMoneyRequest(paymentType, chatReport, iouReport) { * @param {String} reportID */ function startMoneyRequest(iouType, reportID = '') { - resetMoneyRequestInfo(`${iouType}${reportID}`); - Navigation.navigate(ROUTES.getMoneyRequestRoute(iouType, reportID)); + resetMoneyRequestInfo(`${iouType}${reportID}`).then(() => { + Navigation.navigate(ROUTES.getMoneyRequestRoute(iouType, reportID)); + }); } /** From cd62597f9e336eb9cbb3965750c373818b5ceb24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Wed, 2 Aug 2023 10:22:46 +0200 Subject: [PATCH 03/13] remove IOU with invalid data from initial values https://github.com/Expensify/App/issues/23951 --- src/components/Form.js | 1 - src/libs/actions/IOU.js | 18 ++++--- src/pages/iou/steps/MoneyRequestAmountPage.js | 51 ++++++++++--------- .../MoneyRequestParticipantsPage.js | 13 +++-- src/setup/index.js | 4 -- 5 files changed, 49 insertions(+), 38 deletions(-) diff --git a/src/components/Form.js b/src/components/Form.js index 4f4c7527cf1d..ed765ac435c1 100644 --- a/src/components/Form.js +++ b/src/components/Form.js @@ -82,7 +82,6 @@ const defaultProps = { isSubmitButtonVisible: true, formState: { isLoading: false, - errors: null, }, draftValues: {}, enabledWhenOffline: false, diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index f0905eca0a89..868ef1bdba64 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -1438,46 +1438,52 @@ function payMoneyRequest(paymentType, chatReport, iouReport) { * Initialize money request info and navigate to the MoneyRequest page * @param {String} iouType * @param {String} reportID + * @returns {Promise} */ function startMoneyRequest(iouType, reportID = '') { - resetMoneyRequestInfo(`${iouType}${reportID}`).then(() => { + return resetMoneyRequestInfo(`${iouType}${reportID}`).then(() => { Navigation.navigate(ROUTES.getMoneyRequestRoute(iouType, reportID)); }); } /** * @param {String} id + * @returns {Promise} */ function setMoneyRequestId(id) { - Onyx.merge(ONYXKEYS.IOU, {id}); + return Onyx.merge(ONYXKEYS.IOU, {id}); } /** * @param {Number} amount + * @returns {Promise} */ function setMoneyRequestAmount(amount) { - Onyx.merge(ONYXKEYS.IOU, {amount}); + return Onyx.merge(ONYXKEYS.IOU, {amount}); } /** * @param {String} currency + * @returns {Promise} */ function setMoneyRequestCurrency(currency) { - Onyx.merge(ONYXKEYS.IOU, {currency}); + return Onyx.merge(ONYXKEYS.IOU, {currency}); } /** * @param {String} comment + * @returns {Promise} */ function setMoneyRequestDescription(comment) { - Onyx.merge(ONYXKEYS.IOU, {comment: comment.trim()}); + return Onyx.merge(ONYXKEYS.IOU, {comment: comment.trim()}); } /** * @param {Object[]} participants + * @returns {Promise} */ function setMoneyRequestParticipants(participants) { - Onyx.merge(ONYXKEYS.IOU, {participants}); + return Onyx.merge(ONYXKEYS.IOU, {participants}); } export { diff --git a/src/pages/iou/steps/MoneyRequestAmountPage.js b/src/pages/iou/steps/MoneyRequestAmountPage.js index e25f7acb0553..337610f48217 100755 --- a/src/pages/iou/steps/MoneyRequestAmountPage.js +++ b/src/pages/iou/steps/MoneyRequestAmountPage.js @@ -379,14 +379,13 @@ function MoneyRequestAmountPage(props) { const navigateToNextPage = () => { const amountInSmallestCurrencyUnits = CurrencyUtils.convertToSmallestUnit(selectedCurrencyCode, Number.parseFloat(amount)); - IOU.setMoneyRequestAmount(amountInSmallestCurrencyUnits); - IOU.setMoneyRequestCurrency(selectedCurrencyCode); - saveAmountToState(selectedCurrencyCode, amountInSmallestCurrencyUnits); + const iouUpdates = [IOU.setMoneyRequestAmount(amountInSmallestCurrencyUnits), IOU.setMoneyRequestCurrency(selectedCurrencyCode)]; if (isEditing.current) { - Navigation.goBack(ROUTES.getMoneyRequestConfirmationRoute(iouType.current, reportID.current)); - return; + return Promise.all(iouUpdates).then(() => { + Navigation.goBack(ROUTES.getMoneyRequestConfirmationRoute(iouType.current, reportID.current)); + }); } const moneyRequestID = `${iouType.current}${reportID.current}`; @@ -394,28 +393,32 @@ function MoneyRequestAmountPage(props) { // If the money request ID in Onyx does not match the ID from params, we want to start a new request // with the ID from params. We need to clear the participants in case the new request is initiated from FAB. if (shouldReset) { - IOU.setMoneyRequestId(moneyRequestID); - IOU.setMoneyRequestDescription(''); - IOU.setMoneyRequestParticipants([]); + iouUpdates.push(IOU.setMoneyRequestId(moneyRequestID), IOU.setMoneyRequestDescription('')); + if (!props.report.reportID) { + iouUpdates.push(IOU.setMoneyRequestParticipants([])); + } } - // If a request is initiated on a report, skip the participants selection step and navigate to the confirmation page. - if (props.report.reportID) { - // Reinitialize the participants when the money request ID in Onyx does not match the ID from params - if (_.isEmpty(props.iou.participants) || shouldReset) { - const currentUserAccountID = props.currentUserPersonalDetails.accountID; - const participants = ReportUtils.isPolicyExpenseChat(props.report) - ? [{reportID: props.report.reportID, isPolicyExpenseChat: true, selected: true}] - : _.chain(props.report.participantAccountIDs) - .filter((accountID) => currentUserAccountID !== accountID) - .map((accountID) => ({accountID, selected: true})) - .value(); - IOU.setMoneyRequestParticipants(participants); - } - Navigation.navigate(ROUTES.getMoneyRequestConfirmationRoute(iouType.current, reportID.current)); - return; + // Reinitialize the participants when the money request ID in Onyx does not match the ID from params + if (props.report.reportID && (_.isEmpty(props.iou.participants) || shouldReset)) { + const currentUserAccountID = props.currentUserPersonalDetails.accountID; + const participants = ReportUtils.isPolicyExpenseChat(props.report) + ? [{reportID: props.report.reportID, isPolicyExpenseChat: true, selected: true}] + : _.chain(props.report.participantAccountIDs) + .filter((accountID) => currentUserAccountID !== accountID) + .map((accountID) => ({accountID, selected: true})) + .value(); + iouUpdates.push(IOU.setMoneyRequestParticipants(participants)); } - Navigation.navigate(ROUTES.getMoneyRequestParticipantsRoute(iouType.current)); + + Promise.all(iouUpdates).then(() => { + // If a request is initiated on a report, skip the participants selection step and navigate to the confirmation page. + if (props.report.reportID) { + Navigation.navigate(ROUTES.getMoneyRequestConfirmationRoute(iouType.current, reportID.current)); + return; + } + Navigation.navigate(ROUTES.getMoneyRequestParticipantsRoute(iouType.current)); + }); }; const formattedAmount = replaceAllDigits(amount, toLocaleDigit); diff --git a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js index ce26079761eb..a8deb3646413 100644 --- a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js +++ b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js @@ -49,8 +49,15 @@ function MoneyRequestParticipantsPage(props) { const iouType = useRef(lodashGet(props.route, 'params.iouType', '')); const reportID = useRef(lodashGet(props.route, 'params.reportID', '')); + const addingParticipantsPromiseRef = useRef(Promise.resolve()); + const onAddParticipants = (participants) => { + addingParticipantsPromiseRef.current = IOU.setMoneyRequestParticipants(participants); + }; + const navigateToNextStep = () => { - Navigation.navigate(ROUTES.getMoneyRequestConfirmationRoute(iouType.current, reportID.current)); + addingParticipantsPromiseRef.current.then(() => { + Navigation.navigate(ROUTES.getMoneyRequestConfirmationRoute(iouType.current, reportID.current)); + }); }; const navigateBack = (forceFallback = false) => { @@ -98,13 +105,13 @@ function MoneyRequestParticipantsPage(props) { ) : ( diff --git a/src/setup/index.js b/src/setup/index.js index dee506302e81..94aa27707012 100644 --- a/src/setup/index.js +++ b/src/setup/index.js @@ -33,10 +33,6 @@ export default function () { [ONYXKEYS.SESSION]: {loading: false}, [ONYXKEYS.ACCOUNT]: CONST.DEFAULT_ACCOUNT_DATA, [ONYXKEYS.NETWORK]: {isOffline: false}, - [ONYXKEYS.IOU]: { - loading: false, - error: false, - }, [ONYXKEYS.IS_SIDEBAR_LOADED]: false, [ONYXKEYS.SHOULD_SHOW_COMPOSE_INPUT]: true, }, From a3e0e82c4c0bb9bc909e2649114073bc3eab6c7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Mon, 7 Aug 2023 17:39:18 +0200 Subject: [PATCH 04/13] update onyx --- package-lock.json | 16 +++++++--------- package.json | 2 +- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index 85cbf2613ea8..7d1a6328e6b6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -80,7 +80,7 @@ "react-native-key-command": "^1.0.1", "react-native-localize": "^2.2.6", "react-native-modal": "^13.0.0", - "react-native-onyx": "1.0.56", + "react-native-onyx": "1.0.58", "react-native-pager-view": "^6.2.0", "react-native-pdf": "^6.6.2", "react-native-performance": "^4.0.0", @@ -38080,13 +38080,12 @@ } }, "node_modules/react-native-onyx": { - "version": "1.0.56", - "resolved": "https://registry.npmjs.org/react-native-onyx/-/react-native-onyx-1.0.56.tgz", - "integrity": "sha512-6KHwCwCgTtgZ2gGgCFxbJRRL4e2tamCjdbb9ca0jDCUgxZ6NQkEkVhZLaFCPwQn1dX7zonbdbaciFjlUxyOVFQ==", + "version": "1.0.58", + "resolved": "https://registry.npmjs.org/react-native-onyx/-/react-native-onyx-1.0.58.tgz", + "integrity": "sha512-ZUODPgrsRjOgXEnuysf/utkqonTefXFl5BB0f1WRC79pp9Z8rkTObCWXqp3POifJSLrnS9I7UTRVtUpnZqCSEg==", "dependencies": { "ascii-table": "0.0.9", "fast-equals": "^4.0.3", - "lodash": "^4.17.21", "underscore": "^1.13.1" }, "engines": { @@ -71002,13 +71001,12 @@ } }, "react-native-onyx": { - "version": "1.0.56", - "resolved": "https://registry.npmjs.org/react-native-onyx/-/react-native-onyx-1.0.56.tgz", - "integrity": "sha512-6KHwCwCgTtgZ2gGgCFxbJRRL4e2tamCjdbb9ca0jDCUgxZ6NQkEkVhZLaFCPwQn1dX7zonbdbaciFjlUxyOVFQ==", + "version": "1.0.58", + "resolved": "https://registry.npmjs.org/react-native-onyx/-/react-native-onyx-1.0.58.tgz", + "integrity": "sha512-ZUODPgrsRjOgXEnuysf/utkqonTefXFl5BB0f1WRC79pp9Z8rkTObCWXqp3POifJSLrnS9I7UTRVtUpnZqCSEg==", "requires": { "ascii-table": "0.0.9", "fast-equals": "^4.0.3", - "lodash": "^4.17.21", "underscore": "^1.13.1" } }, diff --git a/package.json b/package.json index e46ded32ede7..aa751268658b 100644 --- a/package.json +++ b/package.json @@ -119,7 +119,7 @@ "react-native-key-command": "^1.0.1", "react-native-localize": "^2.2.6", "react-native-modal": "^13.0.0", - "react-native-onyx": "1.0.56", + "react-native-onyx": "1.0.58", "react-native-pager-view": "^6.2.0", "react-native-pdf": "^6.6.2", "react-native-performance": "^4.0.0", From 1c9299386430a7e668f6246d4fe1c91dcddc3029 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Mon, 7 Aug 2023 21:30:38 +0200 Subject: [PATCH 05/13] fix issue with doubling IOU request --- src/libs/actions/IOU.js | 30 +++++++++++++++---- src/pages/iou/ReceiptSelector/index.native.js | 3 +- src/pages/iou/steps/NewRequestAmountPage.js | 5 ++-- 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index 318ec757aedf..6fce645f16c4 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -1512,9 +1512,10 @@ function setMoneyRequestParticipants(participants) { /** * @param {String} receiptPath * @param {String} receiptSource + * @returns {Promise} */ function setMoneyRequestReceipt(receiptPath, receiptSource) { - Onyx.merge(ONYXKEYS.IOU, {receiptPath, receiptSource}); + return Onyx.merge(ONYXKEYS.IOU, {receiptPath, receiptSource}); } /** @@ -1528,10 +1529,11 @@ function setMoneyRequestReceipt(receiptPath, receiptSource) { function navigateToNextPage(iou, iouType, reportID, report) { const moneyRequestID = `${iouType}${reportID}`; const shouldReset = iou.id !== moneyRequestID; + const promises = []; // If the money request ID in Onyx does not match the ID from params, we want to start a new request // with the ID from params. We need to clear the participants in case the new request is initiated from FAB. if (shouldReset) { - resetMoneyRequestInfo(moneyRequestID); + promises.push(resetMoneyRequestInfo(moneyRequestID)); } // If a request is initiated on a report, skip the participants selection step and navigate to the confirmation page. @@ -1545,12 +1547,29 @@ function navigateToNextPage(iou, iouType, reportID, report) { .filter((accountID) => currentUserAccountID !== accountID) .map((accountID) => ({accountID, selected: true})) .value(); - setMoneyRequestParticipants(participants); + promises.push(setMoneyRequestParticipants(participants)); } - Navigation.navigate(ROUTES.getMoneyRequestConfirmationRoute(iouType, reportID)); + Promise.all(promises).then(() => { + Navigation.navigate(ROUTES.getMoneyRequestConfirmationRoute(iouType, reportID)); + }); return; } - Navigation.navigate(ROUTES.getMoneyRequestParticipantsRoute(iouType)); + + Promise.all(promises).then(() => { + Navigation.navigate(ROUTES.getMoneyRequestParticipantsRoute(iouType)); + }); +} + +/** + * @param {String} receiptPath + * @param {String} receiptSource + * @param {String} iouType + * @param {String} reportID + * @param {Object} report + * @returns {Promise} + */ +function setMoneyRequestReceiptAndNavigateToNextPage(receiptPath, receiptSource, iouType, reportID, report) { + return setMoneyRequestReceipt(receiptPath, receiptSource).then(() => navigateToNextPage(ONYXKEYS.IOU, iouType, reportID, report)); } export { @@ -1571,4 +1590,5 @@ export { setMoneyRequestParticipants, setMoneyRequestReceipt, navigateToNextPage, + setMoneyRequestReceiptAndNavigateToNextPage, }; diff --git a/src/pages/iou/ReceiptSelector/index.native.js b/src/pages/iou/ReceiptSelector/index.native.js index 7eeab6e493bd..023f1b6ac6a8 100644 --- a/src/pages/iou/ReceiptSelector/index.native.js +++ b/src/pages/iou/ReceiptSelector/index.native.js @@ -202,8 +202,7 @@ function ReceiptSelector(props) { flash: flash ? 'on' : 'off', }) .then((photo) => { - IOU.setMoneyRequestReceipt(`file://${photo.path}`, photo.path); - IOU.navigateToNextPage(props.iou, iouType, reportID, props.report); + IOU.setMoneyRequestReceiptAndNavigateToNextPage(`file://${photo.path}`, photo.path, props.iou, iouType, reportID, props.report); }) .catch(() => { showCameraAlert(); diff --git a/src/pages/iou/steps/NewRequestAmountPage.js b/src/pages/iou/steps/NewRequestAmountPage.js index 90cc4c20b837..2ae6b4490b8d 100644 --- a/src/pages/iou/steps/NewRequestAmountPage.js +++ b/src/pages/iou/steps/NewRequestAmountPage.js @@ -148,15 +148,14 @@ function NewRequestAmountPage({route, iou, report, errors}) { const navigateToNextPage = (currentAmount) => { const amountInSmallestCurrencyUnits = CurrencyUtils.convertToSmallestUnit(currency, Number.parseFloat(currentAmount)); - IOU.setMoneyRequestAmount(amountInSmallestCurrencyUnits); - IOU.setMoneyRequestCurrency(currency); + const iouUpdates = [IOU.setMoneyRequestAmount(amountInSmallestCurrencyUnits), IOU.setMoneyRequestCurrency(currency)]; if (isEditing) { Navigation.goBack(ROUTES.getMoneyRequestConfirmationRoute(iouType, reportID)); return; } - IOU.navigateToNextPage(iou, iouType, reportID, report); + Promise.all(iouUpdates).then(() => IOU.navigateToNextPage(iou, iouType, reportID, report)) }; const content = ( From 0a230de2b808d8f32442293474540ac34af4abb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Mon, 7 Aug 2023 21:45:28 +0200 Subject: [PATCH 06/13] add missing semicolon --- src/pages/iou/steps/NewRequestAmountPage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/iou/steps/NewRequestAmountPage.js b/src/pages/iou/steps/NewRequestAmountPage.js index 2ae6b4490b8d..3e3cb334a2b8 100644 --- a/src/pages/iou/steps/NewRequestAmountPage.js +++ b/src/pages/iou/steps/NewRequestAmountPage.js @@ -155,7 +155,7 @@ function NewRequestAmountPage({route, iou, report, errors}) { return; } - Promise.all(iouUpdates).then(() => IOU.navigateToNextPage(iou, iouType, reportID, report)) + Promise.all(iouUpdates).then(() => IOU.navigateToNextPage(iou, iouType, reportID, report)); }; const content = ( From f28bf181696385c5d8dc56b0a5d9e231d9b78c86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Mon, 14 Aug 2023 12:54:39 +0200 Subject: [PATCH 07/13] fix crashes navigating back and forth in IOU pages --- src/pages/iou/steps/MoneyRequestConfirmPage.js | 7 +++++-- .../MoneyRequestParticipantsPage.js | 7 +++++-- src/pages/iou/steps/NewRequestAmountPage.js | 7 +++++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/pages/iou/steps/MoneyRequestConfirmPage.js b/src/pages/iou/steps/MoneyRequestConfirmPage.js index 00b223522927..8693bd871e0c 100644 --- a/src/pages/iou/steps/MoneyRequestConfirmPage.js +++ b/src/pages/iou/steps/MoneyRequestConfirmPage.js @@ -87,12 +87,15 @@ function MoneyRequestConfirmPage(props) { // Reset the money request Onyx if the ID in Onyx does not match the ID from params const moneyRequestId = `${iouType.current}${reportID.current}`; const shouldReset = props.iou.id !== moneyRequestId; + let resetPromise = Promise.resolve(); if (shouldReset) { - IOU.resetMoneyRequestInfo(moneyRequestId); + resetPromise = IOU.resetMoneyRequestInfo(moneyRequestId); } if (_.isEmpty(props.iou.participants) || (props.iou.amount === 0 && !props.iou.receiptPath) || shouldReset) { - Navigation.goBack(ROUTES.getMoneyRequestRoute(iouType.current, reportID.current), true); + resetPromise.then(() => { + Navigation.goBack(ROUTES.getMoneyRequestRoute(iouType.current, reportID.current), true); + }); } return () => { diff --git a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js index f38556f4168c..8bbcea221edd 100644 --- a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js +++ b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js @@ -77,12 +77,15 @@ function MoneyRequestParticipantsPage(props) { // Reset the money request Onyx if the ID in Onyx does not match the ID from params const moneyRequestId = `${iouType.current}${reportID.current}`; const shouldReset = props.iou.id !== moneyRequestId; + let resetPromise = Promise.resolve(); if (shouldReset) { - IOU.resetMoneyRequestInfo(moneyRequestId); + resetPromise = IOU.resetMoneyRequestInfo(moneyRequestId); } if ((props.iou.amount === 0 && !props.iou.receiptPath) || shouldReset) { - navigateBack(true); + resetPromise.then(() => { + navigateBack(true); + }); } return () => { diff --git a/src/pages/iou/steps/NewRequestAmountPage.js b/src/pages/iou/steps/NewRequestAmountPage.js index b4e58b31a168..938162c7cc0c 100644 --- a/src/pages/iou/steps/NewRequestAmountPage.js +++ b/src/pages/iou/steps/NewRequestAmountPage.js @@ -118,12 +118,15 @@ function NewRequestAmountPage({route, iou, report}) { } const moneyRequestID = `${iouType}${reportID}`; const shouldReset = iou.id !== moneyRequestID; + let resetPromise = Promise.resolve(); if (shouldReset) { - IOU.resetMoneyRequestInfo(moneyRequestID); + resetPromise = IOU.resetMoneyRequestInfo(moneyRequestID); } if (_.isEmpty(iou.participants) || iou.amount === 0 || shouldReset) { - Navigation.goBack(ROUTES.getMoneyRequestRoute(iouType, reportID), true); + resetPromise.then(() => { + Navigation.goBack(ROUTES.getMoneyRequestRoute(iouType, reportID), true); + }); } } From 6f9da52858c141994288df0ae50fdbe75b7d87db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Mon, 14 Aug 2023 14:48:37 +0200 Subject: [PATCH 08/13] remove hiding keyboard --- src/components/EmojiPicker/EmojiPicker.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/components/EmojiPicker/EmojiPicker.js b/src/components/EmojiPicker/EmojiPicker.js index 2a3a7ba296f2..9dbd9dc3fc29 100644 --- a/src/components/EmojiPicker/EmojiPicker.js +++ b/src/components/EmojiPicker/EmojiPicker.js @@ -1,5 +1,5 @@ import React, {useState, useEffect, useRef, forwardRef, useImperativeHandle} from 'react'; -import {Dimensions, Keyboard} from 'react-native'; +import {Dimensions} from 'react-native'; import _ from 'underscore'; import EmojiPickerMenu from './EmojiPickerMenu'; import CONST from '../../CONST'; @@ -119,10 +119,6 @@ const EmojiPicker = forwardRef((props, ref) => { useImperativeHandle(ref, () => ({showEmojiPicker, isActiveReportAction, hideEmojiPicker, isEmojiPickerVisible, resetEmojiPopoverAnchor})); useEffect(() => { - if (isEmojiPickerVisible) { - Keyboard.dismiss(); - } - const emojiPopoverDimensionListener = Dimensions.addEventListener('change', () => { if (!emojiPopoverAnchor.current) { // In small screen width, the window size change might be due to keyboard open/hide, we should avoid hide EmojiPicker in those cases From b0d81a4699c69de1657d46d49ab16020d77b08ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Tue, 15 Aug 2023 15:42:50 +0200 Subject: [PATCH 09/13] fix: leave auto focus logic to input component --- .../OptionsSelector/BaseOptionsSelector.js | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/components/OptionsSelector/BaseOptionsSelector.js b/src/components/OptionsSelector/BaseOptionsSelector.js index b894e8c3bfc1..7273616ea57e 100755 --- a/src/components/OptionsSelector/BaseOptionsSelector.js +++ b/src/components/OptionsSelector/BaseOptionsSelector.js @@ -96,18 +96,6 @@ class BaseOptionsSelector extends Component { ); this.scrollToIndex(this.props.selectedOptions.length ? 0 : this.state.focusedIndex, false); - - if (!this.props.autoFocus) { - return; - } - - if (this.props.shouldShowTextInput) { - if (this.props.shouldDelayFocus) { - this.focusTimeout = setTimeout(() => this.textInput.focus(), CONST.ANIMATED_TRANSITION); - } else { - this.textInput.focus(); - } - } } componentDidUpdate(prevProps) { @@ -339,6 +327,8 @@ class BaseOptionsSelector extends Component { selectTextOnFocus blurOnSubmit={Boolean(this.state.allOptions.length)} spellCheck={false} + autoFocus={this.props.autoFocus} + shouldDelayFocus={this.props.shouldDelayFocus} /> ); const optionsList = ( From f780e0bf47a075d1ca8b788dba42c61f7e4c2055 Mon Sep 17 00:00:00 2001 From: Marc Glasser Date: Thu, 17 Aug 2023 08:26:48 -1000 Subject: [PATCH 10/13] Remove various deferred navigation logic --- src/libs/actions/IOU.js | 42 +++++++------------ .../iou/steps/MoneyRequestConfirmPage.js | 7 +--- .../MoneyRequestParticipantsPage.js | 16 ++----- src/pages/iou/steps/NewRequestAmountPage.js | 12 +++--- 4 files changed, 25 insertions(+), 52 deletions(-) diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index fae9d052f6d6..7b94ee883d5a 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -70,11 +70,10 @@ Onyx.connect({ /** * Reset money request info from the store with its initial value * @param {String} id - * @returns {Promise} */ function resetMoneyRequestInfo(id = '') { const date = currentDate || moment().format('YYYY-MM-DD'); - return Onyx.merge(ONYXKEYS.IOU, { + Onyx.merge(ONYXKEYS.IOU, { id, amount: 0, currency: lodashGet(currentUserPersonalDetails, 'localCurrencyCode', CONST.CURRENCY.USD), @@ -1465,61 +1464,54 @@ function payMoneyRequest(paymentType, chatReport, iouReport) { * Initialize money request info and navigate to the MoneyRequest page * @param {String} iouType * @param {String} reportID - * @returns {Promise} */ function startMoneyRequest(iouType, reportID = '') { - return resetMoneyRequestInfo(`${iouType}${reportID}`).then(() => { + resetMoneyRequestInfo(`${iouType}${reportID}`).then(() => { Navigation.navigate(ROUTES.getMoneyRequestRoute(iouType, reportID)); }); } /** * @param {String} id - * @returns {Promise} */ function setMoneyRequestId(id) { - return Onyx.merge(ONYXKEYS.IOU, {id}); + Onyx.merge(ONYXKEYS.IOU, {id}); } /** * @param {Number} amount - * @returns {Promise} */ function setMoneyRequestAmount(amount) { - return Onyx.merge(ONYXKEYS.IOU, {amount}); + Onyx.merge(ONYXKEYS.IOU, {amount}); } /** * @param {String} currency - * @returns {Promise} */ function setMoneyRequestCurrency(currency) { - return Onyx.merge(ONYXKEYS.IOU, {currency}); + Onyx.merge(ONYXKEYS.IOU, {currency}); } /** * @param {String} comment - * @returns {Promise} */ function setMoneyRequestDescription(comment) { - return Onyx.merge(ONYXKEYS.IOU, {comment: comment.trim()}); + Onyx.merge(ONYXKEYS.IOU, {comment: comment.trim()}); } /** * @param {Object[]} participants - * @returns {Promise} */ function setMoneyRequestParticipants(participants) { - return Onyx.merge(ONYXKEYS.IOU, {participants}); + Onyx.merge(ONYXKEYS.IOU, {participants}); } /** * @param {String} receiptPath * @param {String} receiptSource - * @returns {Promise} */ function setMoneyRequestReceipt(receiptPath, receiptSource) { - return Onyx.merge(ONYXKEYS.IOU, {receiptPath, receiptSource}); + Onyx.merge(ONYXKEYS.IOU, {receiptPath, receiptSource}); } function createEmptyTransaction() { @@ -1539,11 +1531,11 @@ function createEmptyTransaction() { function navigateToNextPage(iou, iouType, reportID, report) { const moneyRequestID = `${iouType}${reportID}`; const shouldReset = iou.id !== moneyRequestID; - const promises = []; + // If the money request ID in Onyx does not match the ID from params, we want to start a new request // with the ID from params. We need to clear the participants in case the new request is initiated from FAB. if (shouldReset) { - promises.push(resetMoneyRequestInfo(moneyRequestID)); + resetMoneyRequestInfo(moneyRequestID); } // If a request is initiated on a report, skip the participants selection step and navigate to the confirmation page. @@ -1557,17 +1549,13 @@ function navigateToNextPage(iou, iouType, reportID, report) { .filter((accountID) => currentUserAccountID !== accountID) .map((accountID) => ({accountID, selected: true})) .value(); - promises.push(setMoneyRequestParticipants(participants)); + setMoneyRequestParticipants(participants); } - Promise.all(promises).then(() => { - Navigation.navigate(ROUTES.getMoneyRequestConfirmationRoute(iouType, reportID)); - }); + Navigation.navigate(ROUTES.getMoneyRequestConfirmationRoute(iouType, reportID)); return; } - Promise.all(promises).then(() => { - Navigation.navigate(ROUTES.getMoneyRequestParticipantsRoute(iouType)); - }); + Navigation.navigate(ROUTES.getMoneyRequestParticipantsRoute(iouType)); } /** @@ -1576,10 +1564,10 @@ function navigateToNextPage(iou, iouType, reportID, report) { * @param {String} iouType * @param {String} reportID * @param {Object} report - * @returns {Promise} */ function setMoneyRequestReceiptAndNavigateToNextPage(receiptPath, receiptSource, iouType, reportID, report) { - return setMoneyRequestReceipt(receiptPath, receiptSource).then(() => navigateToNextPage(ONYXKEYS.IOU, iouType, reportID, report)); + setMoneyRequestReceipt(receiptPath, receiptSource); + navigateToNextPage(ONYXKEYS.IOU, iouType, reportID, report); } export { diff --git a/src/pages/iou/steps/MoneyRequestConfirmPage.js b/src/pages/iou/steps/MoneyRequestConfirmPage.js index 8693bd871e0c..00b223522927 100644 --- a/src/pages/iou/steps/MoneyRequestConfirmPage.js +++ b/src/pages/iou/steps/MoneyRequestConfirmPage.js @@ -87,15 +87,12 @@ function MoneyRequestConfirmPage(props) { // Reset the money request Onyx if the ID in Onyx does not match the ID from params const moneyRequestId = `${iouType.current}${reportID.current}`; const shouldReset = props.iou.id !== moneyRequestId; - let resetPromise = Promise.resolve(); if (shouldReset) { - resetPromise = IOU.resetMoneyRequestInfo(moneyRequestId); + IOU.resetMoneyRequestInfo(moneyRequestId); } if (_.isEmpty(props.iou.participants) || (props.iou.amount === 0 && !props.iou.receiptPath) || shouldReset) { - resetPromise.then(() => { - Navigation.goBack(ROUTES.getMoneyRequestRoute(iouType.current, reportID.current), true); - }); + Navigation.goBack(ROUTES.getMoneyRequestRoute(iouType.current, reportID.current), true); } return () => { diff --git a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js index 8bbcea221edd..0bed1f2d37b4 100644 --- a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js +++ b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js @@ -49,15 +49,8 @@ function MoneyRequestParticipantsPage(props) { const iouType = useRef(lodashGet(props.route, 'params.iouType', '')); const reportID = useRef(lodashGet(props.route, 'params.reportID', '')); - const addingParticipantsPromiseRef = useRef(Promise.resolve()); - const onAddParticipants = (participants) => { - addingParticipantsPromiseRef.current = IOU.setMoneyRequestParticipants(participants); - }; - const navigateToNextStep = () => { - addingParticipantsPromiseRef.current.then(() => { - Navigation.navigate(ROUTES.getMoneyRequestConfirmationRoute(iouType.current, reportID.current)); - }); + Navigation.navigate(ROUTES.getMoneyRequestConfirmationRoute(iouType.current, reportID.current)); }; const navigateBack = (forceFallback = false) => { @@ -77,15 +70,12 @@ function MoneyRequestParticipantsPage(props) { // Reset the money request Onyx if the ID in Onyx does not match the ID from params const moneyRequestId = `${iouType.current}${reportID.current}`; const shouldReset = props.iou.id !== moneyRequestId; - let resetPromise = Promise.resolve(); if (shouldReset) { - resetPromise = IOU.resetMoneyRequestInfo(moneyRequestId); + IOU.resetMoneyRequestInfo(moneyRequestId); } if ((props.iou.amount === 0 && !props.iou.receiptPath) || shouldReset) { - resetPromise.then(() => { - navigateBack(true); - }); + navigateBack(true); } return () => { diff --git a/src/pages/iou/steps/NewRequestAmountPage.js b/src/pages/iou/steps/NewRequestAmountPage.js index 938162c7cc0c..2df7a32cd56a 100644 --- a/src/pages/iou/steps/NewRequestAmountPage.js +++ b/src/pages/iou/steps/NewRequestAmountPage.js @@ -118,15 +118,12 @@ function NewRequestAmountPage({route, iou, report}) { } const moneyRequestID = `${iouType}${reportID}`; const shouldReset = iou.id !== moneyRequestID; - let resetPromise = Promise.resolve(); if (shouldReset) { - resetPromise = IOU.resetMoneyRequestInfo(moneyRequestID); + IOU.resetMoneyRequestInfo(moneyRequestID) } if (_.isEmpty(iou.participants) || iou.amount === 0 || shouldReset) { - resetPromise.then(() => { - Navigation.goBack(ROUTES.getMoneyRequestRoute(iouType, reportID), true); - }); + Navigation.goBack(ROUTES.getMoneyRequestRoute(iouType, reportID), true); } } @@ -147,14 +144,15 @@ function NewRequestAmountPage({route, iou, report}) { const navigateToNextPage = (currentAmount) => { const amountInSmallestCurrencyUnits = CurrencyUtils.convertToSmallestUnit(currency, Number.parseFloat(currentAmount)); - const iouUpdates = [IOU.setMoneyRequestAmount(amountInSmallestCurrencyUnits), IOU.setMoneyRequestCurrency(currency)]; + IOU.setMoneyRequestAmount(amountInSmallestCurrencyUnits); + IOU.setMoneyRequestCurrency(currency); if (isEditing) { Navigation.goBack(ROUTES.getMoneyRequestConfirmationRoute(iouType, reportID)); return; } - Promise.all(iouUpdates).then(() => IOU.navigateToNextPage(iou, iouType, reportID, report)); + IOU.navigateToNextPage(iou, iouType, reportID, report); }; const content = ( From 871faf6d015932770dd3c57daa8065bda235df20 Mon Sep 17 00:00:00 2001 From: Marc Glasser Date: Thu, 17 Aug 2023 08:30:21 -1000 Subject: [PATCH 11/13] Commit other changes --- src/libs/actions/IOU.js | 6 ++---- .../MoneyRequestParticipantsPage.js | 4 ++-- src/pages/iou/steps/NewRequestAmountPage.js | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index 7b94ee883d5a..bfafa277177d 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -1466,9 +1466,8 @@ function payMoneyRequest(paymentType, chatReport, iouReport) { * @param {String} reportID */ function startMoneyRequest(iouType, reportID = '') { - resetMoneyRequestInfo(`${iouType}${reportID}`).then(() => { - Navigation.navigate(ROUTES.getMoneyRequestRoute(iouType, reportID)); - }); + resetMoneyRequestInfo(`${iouType}${reportID}`); + Navigation.navigate(ROUTES.getMoneyRequestRoute(iouType, reportID)); } /** @@ -1554,7 +1553,6 @@ function navigateToNextPage(iou, iouType, reportID, report) { Navigation.navigate(ROUTES.getMoneyRequestConfirmationRoute(iouType, reportID)); return; } - Navigation.navigate(ROUTES.getMoneyRequestParticipantsRoute(iouType)); } diff --git a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js index 0bed1f2d37b4..d6d069dc0329 100644 --- a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js +++ b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js @@ -98,13 +98,13 @@ function MoneyRequestParticipantsPage(props) { ) : ( diff --git a/src/pages/iou/steps/NewRequestAmountPage.js b/src/pages/iou/steps/NewRequestAmountPage.js index 2df7a32cd56a..ce59840e106d 100644 --- a/src/pages/iou/steps/NewRequestAmountPage.js +++ b/src/pages/iou/steps/NewRequestAmountPage.js @@ -119,7 +119,7 @@ function NewRequestAmountPage({route, iou, report}) { const moneyRequestID = `${iouType}${reportID}`; const shouldReset = iou.id !== moneyRequestID; if (shouldReset) { - IOU.resetMoneyRequestInfo(moneyRequestID) + IOU.resetMoneyRequestInfo(moneyRequestID); } if (_.isEmpty(iou.participants) || iou.amount === 0 || shouldReset) { From 1fd07e313359e9314c62fec56040b2bd0226ab4b Mon Sep 17 00:00:00 2001 From: Marc Glasser Date: Thu, 17 Aug 2023 08:55:24 -1000 Subject: [PATCH 12/13] Bump Onyx version --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index d962c5c5d1af..e0908cb9b10a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -83,7 +83,7 @@ "react-native-linear-gradient": "^2.8.1", "react-native-localize": "^2.2.6", "react-native-modal": "^13.0.0", - "react-native-onyx": "1.0.58", + "react-native-onyx": "1.0.61", "react-native-pager-view": "^6.2.0", "react-native-pdf": "^6.6.2", "react-native-performance": "^4.0.0", @@ -42680,9 +42680,9 @@ } }, "node_modules/react-native-onyx": { - "version": "1.0.58", - "resolved": "https://registry.npmjs.org/react-native-onyx/-/react-native-onyx-1.0.58.tgz", - "integrity": "sha512-ZUODPgrsRjOgXEnuysf/utkqonTefXFl5BB0f1WRC79pp9Z8rkTObCWXqp3POifJSLrnS9I7UTRVtUpnZqCSEg==", + "version": "1.0.61", + "resolved": "https://registry.npmjs.org/react-native-onyx/-/react-native-onyx-1.0.61.tgz", + "integrity": "sha512-8lESU3qczhhWzyJSViZsgREyCZP+evLcrfZ9xmH5ys0PXWVpxUymxZ6zfTWbWlAkCQCFpYSikk2fXcpC6clF0g==", "dependencies": { "ascii-table": "0.0.9", "fast-equals": "^4.0.3", @@ -79211,9 +79211,9 @@ } }, "react-native-onyx": { - "version": "1.0.58", - "resolved": "https://registry.npmjs.org/react-native-onyx/-/react-native-onyx-1.0.58.tgz", - "integrity": "sha512-ZUODPgrsRjOgXEnuysf/utkqonTefXFl5BB0f1WRC79pp9Z8rkTObCWXqp3POifJSLrnS9I7UTRVtUpnZqCSEg==", + "version": "1.0.61", + "resolved": "https://registry.npmjs.org/react-native-onyx/-/react-native-onyx-1.0.61.tgz", + "integrity": "sha512-8lESU3qczhhWzyJSViZsgREyCZP+evLcrfZ9xmH5ys0PXWVpxUymxZ6zfTWbWlAkCQCFpYSikk2fXcpC6clF0g==", "requires": { "ascii-table": "0.0.9", "fast-equals": "^4.0.3", diff --git a/package.json b/package.json index 2e99d278e0f0..0c03f4946874 100644 --- a/package.json +++ b/package.json @@ -122,7 +122,7 @@ "react-native-linear-gradient": "^2.8.1", "react-native-localize": "^2.2.6", "react-native-modal": "^13.0.0", - "react-native-onyx": "1.0.58", + "react-native-onyx": "1.0.61", "react-native-pager-view": "^6.2.0", "react-native-pdf": "^6.6.2", "react-native-performance": "^4.0.0", From 005aa4d1a35706601cc86f3e49a8aa4573ecde42 Mon Sep 17 00:00:00 2001 From: Marc Glasser Date: Thu, 17 Aug 2023 08:57:26 -1000 Subject: [PATCH 13/13] Remove other unneeded things --- src/libs/actions/IOU.js | 13 ------------- src/pages/iou/ReceiptSelector/index.native.js | 3 ++- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index 172b076f555c..339c7d999dc8 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -1622,18 +1622,6 @@ function navigateToNextPage(iou, iouType, reportID, report) { Navigation.navigate(ROUTES.getMoneyRequestParticipantsRoute(iouType)); } -/** - * @param {String} receiptPath - * @param {String} receiptSource - * @param {String} iouType - * @param {String} reportID - * @param {Object} report - */ -function setMoneyRequestReceiptAndNavigateToNextPage(receiptPath, receiptSource, iouType, reportID, report) { - setMoneyRequestReceipt(receiptPath, receiptSource); - navigateToNextPage(ONYXKEYS.IOU, iouType, reportID, report); -} - export { editMoneyRequest, deleteMoneyRequest, @@ -1654,5 +1642,4 @@ export { setMoneyRequestReceipt, createEmptyTransaction, navigateToNextPage, - setMoneyRequestReceiptAndNavigateToNextPage, }; diff --git a/src/pages/iou/ReceiptSelector/index.native.js b/src/pages/iou/ReceiptSelector/index.native.js index 023f1b6ac6a8..7eeab6e493bd 100644 --- a/src/pages/iou/ReceiptSelector/index.native.js +++ b/src/pages/iou/ReceiptSelector/index.native.js @@ -202,7 +202,8 @@ function ReceiptSelector(props) { flash: flash ? 'on' : 'off', }) .then((photo) => { - IOU.setMoneyRequestReceiptAndNavigateToNextPage(`file://${photo.path}`, photo.path, props.iou, iouType, reportID, props.report); + IOU.setMoneyRequestReceipt(`file://${photo.path}`, photo.path); + IOU.navigateToNextPage(props.iou, iouType, reportID, props.report); }) .catch(() => { showCameraAlert();