From b94b7d9ded24bbcae8cdf5d8575ce75b612f759f Mon Sep 17 00:00:00 2001 From: Jakub Butkiewicz Date: Mon, 5 Feb 2024 15:02:56 +0100 Subject: [PATCH 1/4] ref: move react-navigation mock to TS --- __mocks__/@react-navigation/native/{index.js => index.ts} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename __mocks__/@react-navigation/native/{index.js => index.ts} (69%) diff --git a/__mocks__/@react-navigation/native/index.js b/__mocks__/@react-navigation/native/index.ts similarity index 69% rename from __mocks__/@react-navigation/native/index.js rename to __mocks__/@react-navigation/native/index.ts index 09abd0d02bf9..4d0c63d28fce 100644 --- a/__mocks__/@react-navigation/native/index.js +++ b/__mocks__/@react-navigation/native/index.ts @@ -1,7 +1,7 @@ import {useIsFocused as realUseIsFocused} from '@react-navigation/native'; // We only want this mocked for storybook, not jest -const useIsFocused = process.env.NODE_ENV === 'test' ? realUseIsFocused : () => true; +const useIsFocused: () => boolean = process.env.NODE_ENV === 'test' ? realUseIsFocused : () => true; export * from '@react-navigation/core'; export * from '@react-navigation/native'; From 17b08301631205b41d9fe0f0236b5be29b8dc2fe Mon Sep 17 00:00:00 2001 From: Jakub Butkiewicz Date: Mon, 5 Feb 2024 15:25:28 +0100 Subject: [PATCH 2/4] fix: used better type --- __mocks__/@react-navigation/native/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__mocks__/@react-navigation/native/index.ts b/__mocks__/@react-navigation/native/index.ts index 4d0c63d28fce..aa8067a1c862 100644 --- a/__mocks__/@react-navigation/native/index.ts +++ b/__mocks__/@react-navigation/native/index.ts @@ -1,7 +1,7 @@ import {useIsFocused as realUseIsFocused} from '@react-navigation/native'; // We only want this mocked for storybook, not jest -const useIsFocused: () => boolean = process.env.NODE_ENV === 'test' ? realUseIsFocused : () => true; +const useIsFocused: typeof realUseIsFocused = process.env.NODE_ENV === 'test' ? realUseIsFocused : () => true; export * from '@react-navigation/core'; export * from '@react-navigation/native'; From b19b85744b5627bf87181eb9be65c1ec813922a4 Mon Sep 17 00:00:00 2001 From: VickyStash Date: Tue, 6 Feb 2024 17:11:25 +0100 Subject: [PATCH 3/4] Fix crash on iOS if requestAmount is 0 --- src/components/ReportActionItem/MoneyRequestPreview.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ReportActionItem/MoneyRequestPreview.tsx b/src/components/ReportActionItem/MoneyRequestPreview.tsx index f321c63375d0..70a313c77e9e 100644 --- a/src/components/ReportActionItem/MoneyRequestPreview.tsx +++ b/src/components/ReportActionItem/MoneyRequestPreview.tsx @@ -321,7 +321,7 @@ function MoneyRequestPreview({ {shouldShowDescription && } {shouldShowMerchant && {merchantOrDescription}} - {isBillSplit && participantAccountIDs.length > 0 && requestAmount && requestAmount > 0 && ( + {isBillSplit && participantAccountIDs.length > 0 && !!requestAmount && requestAmount > 0 && ( {translate('iou.amountEach', { amount: CurrencyUtils.convertToDisplayString( From 3199e7e225f1469f10c2447c158d5e04f42b1945 Mon Sep 17 00:00:00 2001 From: Filip Solecki Date: Tue, 6 Feb 2024 18:15:48 +0100 Subject: [PATCH 4/4] Fix after regression --- src/pages/ShareCodePage.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/ShareCodePage.tsx b/src/pages/ShareCodePage.tsx index 831f0eb8f1d8..dcfb9f6861bf 100644 --- a/src/pages/ShareCodePage.tsx +++ b/src/pages/ShareCodePage.tsx @@ -109,7 +109,8 @@ function ShareCodePage({report, session, currentUserPersonalDetails}: ShareCodeP isAnonymousAction title={translate('common.download')} icon={Expensicons.Download} - onPress={qrCodeRef.current?.download} + // eslint-disable-next-line @typescript-eslint/no-misused-promises + onPress={() => qrCodeRef.current?.download?.()} /> )}