diff --git a/src/components/Search/SearchList/ListItem/TextWithIconCell.tsx b/src/components/Search/SearchList/ListItem/TextWithIconCell.tsx index 727b646638e8..4f989317523a 100644 --- a/src/components/Search/SearchList/ListItem/TextWithIconCell.tsx +++ b/src/components/Search/SearchList/ListItem/TextWithIconCell.tsx @@ -13,13 +13,14 @@ import {View} from 'react-native'; type TextWithIconCellProps = { icon: IconAsset; + iconSize?: number; text?: string; showTooltip: boolean; textStyle?: StyleProp; numberOfLines?: number; }; -export default function TextWithIconCell({icon, text, showTooltip, textStyle, numberOfLines = 1}: TextWithIconCellProps) { +export default function TextWithIconCell({icon, iconSize = 12, text, showTooltip, textStyle, numberOfLines = 1}: TextWithIconCellProps) { const styles = useThemeStyles(); const theme = useTheme(); @@ -32,8 +33,8 @@ export default function TextWithIconCell({icon, text, showTooltip, textStyle, nu ), getItemText: (item) => translate(item.translationPath), diff --git a/tests/unit/SearchRouterNavigationTest.ts b/tests/unit/SearchRouterNavigationTest.ts index 6d0d58b6b0bc..5cee95dedfba 100644 --- a/tests/unit/SearchRouterNavigationTest.ts +++ b/tests/unit/SearchRouterNavigationTest.ts @@ -15,6 +15,8 @@ import Navigation from '@libs/Navigation/Navigation'; import navigateToCannedSpendSearch from '@libs/SearchNavigationUtils'; import type {SearchTypeMenuItem, SearchTypeMenuSection} from '@libs/SearchUIUtils'; +import variables from '@styles/variables'; + import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; import type IconAsset from '@src/types/utils/IconAsset'; @@ -416,11 +418,11 @@ describe('Spend Search Router navigation source', () => { expect(result.current.some((item) => item.keyForList === `spend_${CONST.SEARCH.SAVED_SEARCH_PREFIX}1`)).toBe(false); const rightElement = result.current.at(0)?.rightElement; - expect(isValidElement<{label: string; icon: IconAsset}>(rightElement)).toBe(true); - if (!isValidElement<{label: string; icon: IconAsset}>(rightElement)) { + expect(isValidElement<{text: string; icon: IconAsset; iconSize: number; showTooltip: boolean}>(rightElement)).toBe(true); + if (!isValidElement<{text: string; icon: IconAsset; iconSize: number; showTooltip: boolean}>(rightElement)) { throw new Error('Expected Spend navigation context to be a React element'); } - expect(rightElement.props).toMatchObject({text: 'Spend', icon: spendContextIcon, showTooltip: false}); + expect(rightElement.props).toMatchObject({text: 'Spend', icon: spendContextIcon, iconSize: variables.fontSizeLabel, showTooltip: false}); rerender({shouldWatchForApprovals: true}); expect(mockUseSearchTypeMenuSections).toHaveBeenLastCalledWith(undefined, true);