Skip to content

Commit

Permalink
Add contentFit prop to MenuItem
Browse files Browse the repository at this point in the history
  • Loading branch information
WojtekBoman committed Dec 20, 2023
1 parent b739e34 commit dcc4994
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/components/MenuItem.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import ExpensiMark from 'expensify-common/lib/ExpensiMark';
import {ImageContentFit} from 'expo-image';
import React, {ForwardedRef, forwardRef, ReactNode, useEffect, useMemo, useRef, useState} from 'react';
import {GestureResponderEvent, StyleProp, TextStyle, View, ViewStyle} from 'react-native';
import {AnimatedStyle} from 'react-native-reanimated';
Expand Down Expand Up @@ -226,6 +227,9 @@ type MenuItemProps = (ResponsiveProps | UnresponsiveProps) &

/** Icon should be displayed in its own color */
displayInDefaultIconColor?: boolean;

/** Determines how the icon should be resized to fit its container */
contentFit?: ImageContentFit;
};

function MenuItem(
Expand Down Expand Up @@ -287,6 +291,7 @@ function MenuItem(
onSecondaryInteraction,
titleWithTooltips,
displayInDefaultIconColor = false,
contentFit = 'cover',
}: MenuItemProps,
ref: ForwardedRef<View>,
) {
Expand Down Expand Up @@ -428,6 +433,7 @@ function MenuItem(
<View style={[styles.popoverMenuIcon, iconStyles, StyleUtils.getAvatarWidthStyle(avatarSize)]}>
{typeof icon !== 'string' && iconType === CONST.ICON_TYPE_ICON && (
<Icon
contentFit={contentFit}
hovered={isHovered}
pressed={pressed}
src={icon}
Expand Down Expand Up @@ -463,6 +469,7 @@ function MenuItem(
{secondaryIcon && (
<View style={[styles.popoverMenuIcon, iconStyles]}>
<Icon
contentFit={contentFit}
src={secondaryIcon}
width={iconWidth}
height={iconHeight}
Expand Down

0 comments on commit dcc4994

Please sign in to comment.