From ceaa7465fc8fd4c83b56f15e7dddd1d1c9ea5913 Mon Sep 17 00:00:00 2001 From: Puneet Lath Date: Wed, 8 Dec 2021 17:43:31 -0500 Subject: [PATCH 01/10] Refactor CurrentWalletBalance to use ExpensifyText instead of Text --- src/components/CurrentWalletBalance.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/CurrentWalletBalance.js b/src/components/CurrentWalletBalance.js index 9d4e18dfe4a9..c894466668fe 100644 --- a/src/components/CurrentWalletBalance.js +++ b/src/components/CurrentWalletBalance.js @@ -1,6 +1,5 @@ import React from 'react'; -// eslint-disable-next-line no-restricted-imports -import {ActivityIndicator, Text} from 'react-native'; +import {ActivityIndicator} from 'react-native'; import PropTypes from 'prop-types'; import _ from 'underscore'; import {withOnyx} from 'react-native-onyx'; @@ -9,6 +8,7 @@ import withLocalize, {withLocalizePropTypes} from './withLocalize'; import compose from '../libs/compose'; import themeColors from '../styles/themes/default'; import ONYXKEYS from '../ONYXKEYS'; +import ExpensifyText from './ExpensifyText'; const propTypes = { /** The user's wallet account */ @@ -40,11 +40,11 @@ const CurrentWalletBalance = (props) => { {style: 'currency', currency: 'USD'}, ); return ( - {`${formattedBalance}`} - + ); }; From 7d182337f5434ba228c2b4e173ac8ce7cb1bf155 Mon Sep 17 00:00:00 2001 From: Puneet Lath Date: Wed, 8 Dec 2021 17:51:56 -0500 Subject: [PATCH 02/10] Refactor InlineCodeBlock to use ExpensifyText instead of Text --- src/components/InlineCodeBlock/index.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/components/InlineCodeBlock/index.js b/src/components/InlineCodeBlock/index.js index d83a716880cb..12a062c45a04 100644 --- a/src/components/InlineCodeBlock/index.js +++ b/src/components/InlineCodeBlock/index.js @@ -1,7 +1,6 @@ import React from 'react'; -// eslint-disable-next-line no-restricted-imports -import {Text} from 'react-native'; import inlineCodeBlockPropTypes from './inlineCodeBlockPropTypes'; +import ExpensifyText from '../ExpensifyText'; const InlineCodeBlock = (props) => { const TDefaultRenderer = props.TDefaultRenderer; @@ -10,11 +9,11 @@ const InlineCodeBlock = (props) => { // eslint-disable-next-line react/jsx-props-no-spreading {...props.defaultRendererProps} > - {props.defaultRendererProps.tnode.data} - + ); }; From 4f62ec14c96bad53c6a8fe010e3c468c90abd160 Mon Sep 17 00:00:00 2001 From: Puneet Lath Date: Wed, 8 Dec 2021 17:53:35 -0500 Subject: [PATCH 03/10] Add comment indicating why Text is being imported into ExpensifyText --- src/components/ExpensifyText.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/ExpensifyText.js b/src/components/ExpensifyText.js index 6ea8f73dbd25..fd7b831082c7 100644 --- a/src/components/ExpensifyText.js +++ b/src/components/ExpensifyText.js @@ -1,6 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import _ from 'underscore'; +// importing react-native Text as base for ExpensifyText component // eslint-disable-next-line no-restricted-imports import {Text as RNText} from 'react-native'; import fontFamily from '../styles/fontFamily'; From 2b140f3e229890cae192105018fd674b5bb55a32 Mon Sep 17 00:00:00 2001 From: Puneet Lath Date: Wed, 8 Dec 2021 18:16:32 -0500 Subject: [PATCH 04/10] Refactor PaymentMethodList to use ExpensifyText instead of Text --- src/pages/settings/Payments/PaymentMethodList.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pages/settings/Payments/PaymentMethodList.js b/src/pages/settings/Payments/PaymentMethodList.js index db559f52d2a6..15f6548a9cef 100644 --- a/src/pages/settings/Payments/PaymentMethodList.js +++ b/src/pages/settings/Payments/PaymentMethodList.js @@ -1,13 +1,13 @@ import _ from 'underscore'; import React, {Component} from 'react'; import PropTypes from 'prop-types'; -// eslint-disable-next-line no-restricted-imports -import {FlatList, Text} from 'react-native'; +import {FlatList} from 'react-native'; import {withOnyx} from 'react-native-onyx'; import lodashGet from 'lodash/get'; import styles from '../../../styles/styles'; import * as StyleUtils from '../../../styles/StyleUtils'; import MenuItem from '../../../components/MenuItem'; +import ExpensifyText from '../../../components/ExpensifyText'; import compose from '../../../libs/compose'; import withLocalize, {withLocalizePropTypes} from '../../../components/withLocalize'; import ONYXKEYS from '../../../ONYXKEYS'; @@ -173,11 +173,11 @@ class PaymentMethodList extends Component { } return ( - {item.text} - + ); } From 14637e501b385e86223cfddd26380530ecf08ee9 Mon Sep 17 00:00:00 2001 From: Puneet Lath Date: Wed, 8 Dec 2021 18:29:29 -0500 Subject: [PATCH 05/10] Refactor ExpensiPicker to use ExpensifyText instead of Text --- src/components/ExpensiPicker.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/ExpensiPicker.js b/src/components/ExpensiPicker.js index 4a6f4fc69649..54473163ea27 100644 --- a/src/components/ExpensiPicker.js +++ b/src/components/ExpensiPicker.js @@ -1,9 +1,9 @@ import _ from 'underscore'; import React, {PureComponent} from 'react'; -// eslint-disable-next-line no-restricted-imports -import {Text, View} from 'react-native'; +import {View} from 'react-native'; import PropTypes from 'prop-types'; import Picker from './Picker'; +import ExpensifyText from './ExpensifyText'; import styles from '../styles/styles'; import InlineErrorText from './InlineErrorText'; @@ -47,7 +47,7 @@ class ExpensiPicker extends PureComponent { ]} > {this.props.label && ( - {this.props.label} + {this.props.label} )} this.setState({isOpen: true})} From ca78fa5d990e4b61b857b00659b1f1903b417357 Mon Sep 17 00:00:00 2001 From: Puneet Lath Date: Wed, 8 Dec 2021 19:05:41 -0500 Subject: [PATCH 06/10] Add line break above comment --- src/components/ExpensifyText.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/ExpensifyText.js b/src/components/ExpensifyText.js index fd7b831082c7..b26dc9111db0 100644 --- a/src/components/ExpensifyText.js +++ b/src/components/ExpensifyText.js @@ -1,6 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import _ from 'underscore'; + // importing react-native Text as base for ExpensifyText component // eslint-disable-next-line no-restricted-imports import {Text as RNText} from 'react-native'; From 4a9156ed930caca98f7f9bdefed061983d02aba9 Mon Sep 17 00:00:00 2001 From: Puneet Lath Date: Wed, 8 Dec 2021 19:47:07 -0500 Subject: [PATCH 07/10] Refactor PressableWithSecondaryInteraction to use ExpensifyText instead of Text on Android --- .../PressableWithSecondaryInteraction/index.android.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/PressableWithSecondaryInteraction/index.android.js b/src/components/PressableWithSecondaryInteraction/index.android.js index ea7bb114d56d..9cdfa65f8db1 100644 --- a/src/components/PressableWithSecondaryInteraction/index.android.js +++ b/src/components/PressableWithSecondaryInteraction/index.android.js @@ -1,9 +1,9 @@ import _ from 'underscore'; import React, {forwardRef} from 'react'; import ReactNativeHapticFeedback from 'react-native-haptic-feedback'; -// eslint-disable-next-line no-restricted-imports -import {Pressable, Platform, Text as RNText} from 'react-native'; +import {Pressable, Platform} from 'react-native'; import * as pressableWithSecondaryInteractionPropTypes from './pressableWithSecondaryInteractionPropTypes'; +import ExpensifyText from '../ExpensifyText'; /** * Triggers haptic feedback, and calls onSecondaryInteraction @@ -34,7 +34,7 @@ function handleLongPress(event, props) { */ const PressableWithSecondaryInteraction = (props) => { // Use Text node for inline mode to prevent content overflow. - const Node = props.inline ? RNText : Pressable; + const Node = props.inline ? ExpensifyText : Pressable; return ( Date: Wed, 8 Dec 2021 20:22:23 -0500 Subject: [PATCH 08/10] Refactor PressableWithSecondaryInteraction to use ExpensifyText instead of Text on iOS --- .../PressableWithSecondaryInteraction/index.ios.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/PressableWithSecondaryInteraction/index.ios.js b/src/components/PressableWithSecondaryInteraction/index.ios.js index 2709bd18d4e0..d923f8d0d15f 100644 --- a/src/components/PressableWithSecondaryInteraction/index.ios.js +++ b/src/components/PressableWithSecondaryInteraction/index.ios.js @@ -1,9 +1,9 @@ import _ from 'underscore'; import React, {forwardRef} from 'react'; import ReactNativeHapticFeedback from 'react-native-haptic-feedback'; -// eslint-disable-next-line no-restricted-imports -import {Pressable, Text as RNText} from 'react-native'; +import {Pressable} from 'react-native'; import * as pressableWithSecondaryInteractionPropTypes from './pressableWithSecondaryInteractionPropTypes'; +import ExpensifyText from '../ExpensifyText'; /** * This is a special Pressable that calls onSecondaryInteraction when LongPressed. @@ -13,7 +13,7 @@ import * as pressableWithSecondaryInteractionPropTypes from './pressableWithSeco */ const PressableWithSecondaryInteraction = (props) => { // Use Text node for inline mode to prevent content overflow. - const Node = props.inline ? RNText : Pressable; + const Node = props.inline ? ExpensifyText : Pressable; return ( Date: Thu, 9 Dec 2021 12:00:31 -0500 Subject: [PATCH 09/10] Refactor MarkerBadge to use ExpensifyText instead of Text --- src/pages/home/report/MarkerBadge/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pages/home/report/MarkerBadge/index.js b/src/pages/home/report/MarkerBadge/index.js index 771799bc859b..1e4bcb3bab69 100644 --- a/src/pages/home/report/MarkerBadge/index.js +++ b/src/pages/home/report/MarkerBadge/index.js @@ -1,9 +1,9 @@ import React, {PureComponent} from 'react'; -// eslint-disable-next-line no-restricted-imports -import {Animated, Text, View} from 'react-native'; +import {Animated, View} from 'react-native'; import PropTypes from 'prop-types'; import styles from '../../../../styles/styles'; import ExpensifyButton from '../../../../components/ExpensifyButton'; +import ExpensifyText from '../../../../components/ExpensifyText'; import Icon from '../../../../components/Icon'; import * as Expensicons from '../../../../components/Icon/Expensicons'; import themeColors from '../../../../styles/themes/default'; @@ -85,7 +85,7 @@ class MarkerBadge extends PureComponent { ContentComponent={() => ( - + )} shouldRemoveRightBorderRadius From 9632c3aa247c6ca39a9ce8f63c0f12257ba3af01 Mon Sep 17 00:00:00 2001 From: Puneet Lath Date: Mon, 13 Dec 2021 10:16:18 -0500 Subject: [PATCH 10/10] Remove unnecessariy comment from ExpensifyText --- src/components/ExpensifyText.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/components/ExpensifyText.js b/src/components/ExpensifyText.js index b26dc9111db0..6ea8f73dbd25 100644 --- a/src/components/ExpensifyText.js +++ b/src/components/ExpensifyText.js @@ -1,8 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; import _ from 'underscore'; - -// importing react-native Text as base for ExpensifyText component // eslint-disable-next-line no-restricted-imports import {Text as RNText} from 'react-native'; import fontFamily from '../styles/fontFamily';