From aa306fde8b387404421d6ab207a359c63b0c6fe5 Mon Sep 17 00:00:00 2001 From: Vit Horacek Date: Tue, 22 Aug 2023 15:00:55 +0100 Subject: [PATCH 1/4] Make sure to use the link as a key for transactoin --- src/components/BlockingViews/BlockingView.js | 8 +++++--- src/components/BlockingViews/FullPageNotFoundView.js | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/BlockingViews/BlockingView.js b/src/components/BlockingViews/BlockingView.js index d02fa55a6434..6ec8b5250f37 100644 --- a/src/components/BlockingViews/BlockingView.js +++ b/src/components/BlockingViews/BlockingView.js @@ -9,6 +9,7 @@ import themeColors from '../../styles/themes/default'; import TextLink from '../TextLink'; import Navigation from '../../libs/Navigation/Navigation'; import AutoEmailLink from '../AutoEmailLink'; +import useLocalize from '../../hooks/useLocalize'; const propTypes = { /** Expensicon for the page */ @@ -24,7 +25,7 @@ const propTypes = { subtitle: PropTypes.string, /** Link message below the subtitle */ - link: PropTypes.string, + linkKey: PropTypes.string, /** Whether we should show a link to navigate elsewhere */ shouldShowLink: PropTypes.bool, @@ -43,13 +44,14 @@ const defaultProps = { iconColor: themeColors.offline, subtitle: '', shouldShowLink: false, - link: 'notFound.goBackHome', + linkKey: 'notFound.goBackHome', iconWidth: variables.iconSizeSuperLarge, iconHeight: variables.iconSizeSuperLarge, onLinkPress: () => Navigation.dismissModal(), }; function BlockingView(props) { + const {translate} = useLocalize(); return ( - {props.link} + {translate(props.linkKey)} ) : null} diff --git a/src/components/BlockingViews/FullPageNotFoundView.js b/src/components/BlockingViews/FullPageNotFoundView.js index c52e61ec4b92..a9ff98062d2c 100644 --- a/src/components/BlockingViews/FullPageNotFoundView.js +++ b/src/components/BlockingViews/FullPageNotFoundView.js @@ -69,7 +69,7 @@ function FullPageNotFoundView(props) { iconHeight={variables.modalTopIconHeight} title={props.translate(props.titleKey)} subtitle={props.translate(props.subtitleKey)} - link={props.translate(props.linkKey)} + linkKey={props.translate(props.linkKey)} shouldShowLink={props.shouldShowLink} onLinkPress={props.onLinkPress} /> From 4777c2aadcd9b02bbdc1f6495d6246ac60ede1e5 Mon Sep 17 00:00:00 2001 From: Vit Horacek Date: Tue, 22 Aug 2023 15:13:46 +0100 Subject: [PATCH 2/4] Pass the prop without translating --- package-lock.json | 2 +- src/components/BlockingViews/FullPageNotFoundView.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 440e2eda18df..5670ffcb5354 100644 --- a/package-lock.json +++ b/package-lock.json @@ -107,7 +107,7 @@ "react-native-web-linear-gradient": "^1.1.2", "react-native-web-lottie": "^1.4.4", "react-native-webview": "^11.17.2", - "react-native-x-maps": "1.0.9", + "react-native-x-maps": "^1.0.9", "react-pdf": "^6.2.2", "react-plaid-link": "3.3.2", "react-web-config": "^1.0.0", diff --git a/src/components/BlockingViews/FullPageNotFoundView.js b/src/components/BlockingViews/FullPageNotFoundView.js index a9ff98062d2c..bed060aaf5d4 100644 --- a/src/components/BlockingViews/FullPageNotFoundView.js +++ b/src/components/BlockingViews/FullPageNotFoundView.js @@ -69,7 +69,7 @@ function FullPageNotFoundView(props) { iconHeight={variables.modalTopIconHeight} title={props.translate(props.titleKey)} subtitle={props.translate(props.subtitleKey)} - linkKey={props.translate(props.linkKey)} + linkKey={props.linkKey} shouldShowLink={props.shouldShowLink} onLinkPress={props.onLinkPress} /> From 46778cf4eb89e8ec6166b140358df48dda61f385 Mon Sep 17 00:00:00 2001 From: Vit Horacek Date: Tue, 22 Aug 2023 15:17:55 +0100 Subject: [PATCH 3/4] Address PR feedback --- .../BlockingViews/FullPageNotFoundView.js | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/components/BlockingViews/FullPageNotFoundView.js b/src/components/BlockingViews/FullPageNotFoundView.js index bed060aaf5d4..54bdc015de37 100644 --- a/src/components/BlockingViews/FullPageNotFoundView.js +++ b/src/components/BlockingViews/FullPageNotFoundView.js @@ -3,16 +3,13 @@ import PropTypes from 'prop-types'; import {View} from 'react-native'; import BlockingView from './BlockingView'; import * as Illustrations from '../Icon/Illustrations'; -import withLocalize, {withLocalizePropTypes} from '../withLocalize'; import HeaderWithBackButton from '../HeaderWithBackButton'; import Navigation from '../../libs/Navigation/Navigation'; import variables from '../../styles/variables'; import styles from '../../styles/styles'; +import useLocalize from '../../hooks/useLocalize'; const propTypes = { - /** Props to fetch translation features */ - ...withLocalizePropTypes, - /** Child elements */ children: PropTypes.node, @@ -54,35 +51,36 @@ const defaultProps = { }; // eslint-disable-next-line rulesdir/no-negated-variables -function FullPageNotFoundView(props) { - if (props.shouldShow) { +function FullPageNotFoundView({children, shouldShow, titleKey, subtitleKey, linkKey, onBackButtonPress, shouldShowLink, shouldShowBackButton, onLinkPress}) { + const {translate} = useLocalize(); + if (shouldShow) { return ( <> ); } - return props.children; + return children; } FullPageNotFoundView.propTypes = propTypes; FullPageNotFoundView.defaultProps = defaultProps; FullPageNotFoundView.displayName = 'FullPageNotFoundView'; -export default withLocalize(FullPageNotFoundView); +export default FullPageNotFoundView; From f724e9b5cb10b267131d04947e6ac389456f79bc Mon Sep 17 00:00:00 2001 From: Vit Horacek Date: Tue, 22 Aug 2023 15:23:08 +0100 Subject: [PATCH 4/4] Revert package lock change --- package-lock.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 5670ffcb5354..440e2eda18df 100644 --- a/package-lock.json +++ b/package-lock.json @@ -107,7 +107,7 @@ "react-native-web-linear-gradient": "^1.1.2", "react-native-web-lottie": "^1.4.4", "react-native-webview": "^11.17.2", - "react-native-x-maps": "^1.0.9", + "react-native-x-maps": "1.0.9", "react-pdf": "^6.2.2", "react-plaid-link": "3.3.2", "react-web-config": "^1.0.0",