Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix admin badge not crossed out when removing admin offline #39010

Merged
merged 1 commit into from
Mar 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading