diff --git a/src/components/LHNOptionsList/LHNOptionsList.tsx b/src/components/LHNOptionsList/LHNOptionsList.tsx index 6405e3026b1a0..27325be54168b 100644 --- a/src/components/LHNOptionsList/LHNOptionsList.tsx +++ b/src/components/LHNOptionsList/LHNOptionsList.tsx @@ -10,7 +10,7 @@ import Icon from '@components/Icon'; import * as Expensicons from '@components/Icon/Expensicons'; import LottieAnimations from '@components/LottieAnimations'; import {ScrollOffsetContext} from '@components/ScrollOffsetContextProvider'; -import Text from '@components/Text'; +import TextBlock from '@components/TextBlock'; import useLocalize from '@hooks/useLocalize'; import usePermissions from '@hooks/usePermissions'; import usePrevious from '@hooks/usePrevious'; @@ -69,36 +69,52 @@ function LHNOptionsList({ const emptyLHNSubtitle = useMemo( () => ( - - - {translate('common.emptyLHN.subtitleText1')} - - {translate('common.emptyLHN.subtitleText2')} - - {translate('common.emptyLHN.subtitleText3')} - + + + + + + ), - [theme, styles.alignItemsCenter, styles.textAlignCenter, translate], + [ + styles.alignItemsCenter, + styles.flexRow, + styles.justifyContentCenter, + styles.flexWrap, + styles.textAlignCenter, + styles.mh1, + theme.icon, + theme.textSupporting, + styles.textNormal, + translate, + ], ); /** diff --git a/src/components/TextBlock.tsx b/src/components/TextBlock.tsx new file mode 100644 index 0000000000000..8b036f42f4cc2 --- /dev/null +++ b/src/components/TextBlock.tsx @@ -0,0 +1,39 @@ +/** + * TextBlock component splits a given text into individual words and displays + * each word within a Text component. + */ +import React, {memo, useMemo} from 'react'; +import type {StyleProp, TextStyle} from 'react-native'; +import Text from './Text'; + +type TextBlockProps = { + /** The color of the text */ + color?: string; + + /** Styles to apply to each text word */ + textStyles?: StyleProp; + + /** The full text to be split into words */ + text: string; +}; + +function TextBlock({color, textStyles, text}: TextBlockProps) { + const words = useMemo(() => text.match(/(\S+\s*)/g) ?? [], [text]); + + return ( + <> + {words.map((word) => ( + + {word} + + ))} + + ); +} + +TextBlock.displayName = 'TextBlock'; + +export default memo(TextBlock);