Skip to content

Commit

Permalink
Merge pull request Expensify#39010 from apeyada/fix-37776
Browse files Browse the repository at this point in the history
fix admin badge not crossed out when removing admin offline
  • Loading branch information
rlinoz authored Mar 27, 2024
2 parents 69a2849 + 79155d4 commit cd18bef
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/components/Badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ type BadgeProps = {

/** Any additional styles to pass to the left icon container. */
iconStyles?: StyleProp<ViewStyle>;

/** Additional styles from OfflineWithFeedback applied to the row */
style?: StyleProp<ViewStyle>;
};

function Badge({
Expand All @@ -54,13 +57,16 @@ function Badge({
onPress = () => {},
icon,
iconStyles = [],
style,
}: BadgeProps) {
const styles = useThemeStyles();
const StyleUtils = useStyleUtils();
const theme = useTheme();
const textColorStyles = success || error ? styles.textWhite : undefined;
const Wrapper = pressable ? PressableWithoutFeedback : View;

const isDeleted = style && Array.isArray(style) ? style.includes(styles.offlineFeedback.deleted) : false;

const wrapperStyles: (state: PressableStateCallbackType) => StyleProp<ViewStyle> = useCallback(
({pressed}) => [styles.badge, styles.ml2, StyleUtils.getBadgeColorStyle(success, error, pressed, environment === CONST.ENVIRONMENT.ADHOC), badgeStyles],
[styles.badge, styles.ml2, StyleUtils, success, error, environment, badgeStyles],
Expand All @@ -86,7 +92,7 @@ function Badge({
</View>
)}
<Text
style={[styles.badgeText, textColorStyles, textStyles]}
style={[styles.badgeText, textColorStyles, textStyles, isDeleted ? styles.offlineFeedback.deleted : {}]}
numberOfLines={1}
>
{text}
Expand Down

0 comments on commit cd18bef

Please sign in to comment.