Skip to content

Commit

Permalink
use isLargeScreenWidth
Browse files Browse the repository at this point in the history
  • Loading branch information
luacmartins committed May 2, 2024
1 parent cfd5990 commit b475b28
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/components/SelectionList/TransactionListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,14 @@ function TransactionListItem<TItem extends ListItem>({
const styles = useThemeStyles();
const {translate} = useLocalize();
const theme = useTheme();
const {isSmallScreenWidth, isMediumScreenWidth} = useWindowDimensions();
const {isLargeScreenWidth} = useWindowDimensions();
const StyleUtils = useStyleUtils();

function getMerchant() {
const merchant = TransactionUtils.getMerchant(transactionItem as OnyxEntry<Transaction>);
return merchant === CONST.TRANSACTION.PARTIAL_TRANSACTION_MERCHANT || merchant === CONST.TRANSACTION.DEFAULT_MERCHANT ? '' : merchant;
}

const isNarrowView = isMediumScreenWidth || isSmallScreenWidth;
const isFromExpenseReport = transactionItem.reportType === CONST.REPORT.TYPE.EXPENSE;
const date = TransactionUtils.getCreated(transactionItem as OnyxEntry<Transaction>, CONST.DATE.MONTH_DAY_ABBR_FORMAT);
const amount = TransactionUtils.getAmount(transactionItem as OnyxEntry<Transaction>, isFromExpenseReport);
Expand All @@ -71,7 +70,7 @@ function TransactionListItem<TItem extends ListItem>({
<TextWithTooltip
shouldShowTooltip={showTooltip}
text={date}
style={[styles.label, styles.pre, styles.justifyContentCenter, isNarrowView ? [styles.textMicro, styles.textSupporting] : undefined]}
style={[styles.label, styles.pre, styles.justifyContentCenter, isLargeScreenWidth ? undefined : [styles.textMicro, styles.textSupporting]]}
/>
);

Expand Down Expand Up @@ -111,16 +110,16 @@ function TransactionListItem<TItem extends ListItem>({
<TextWithTooltip
shouldShowTooltip={showTooltip}
text={CurrencyUtils.convertToDisplayString(amount, currency)}
style={[styles.optionDisplayName, styles.textNewKansasNormal, styles.pre, styles.justifyContentCenter, isNarrowView ? styles.textAlignRight : undefined]}
style={[styles.optionDisplayName, styles.textNewKansasNormal, styles.pre, styles.justifyContentCenter, isLargeScreenWidth ? undefined : styles.textAlignRight]}
/>
);

const typeCell = (
<Icon
src={typeIcon}
fill={theme.icon}
height={isNarrowView ? 12 : 20}
width={isNarrowView ? 12 : 20}
height={isLargeScreenWidth ? 20 : 12}
width={isLargeScreenWidth ? 20 : 12}
/>
);

Expand All @@ -138,7 +137,7 @@ function TransactionListItem<TItem extends ListItem>({

const listItemPressableStyle = [styles.selectionListPressableItemWrapper, styles.pv3, item.isSelected && styles.activeComponentBG, isFocused && styles.sidebarLinkActive];

if (isNarrowView) {
if (!isLargeScreenWidth) {
return (
<BaseListItem
item={item}
Expand Down

0 comments on commit b475b28

Please sign in to comment.