Skip to content

Commit f355b20

Browse files
puneetlathOSBotify
authored andcommitted
Merge pull request #84385 from abzokhattab/abzokhattab/fix-badge-style-regressions
badge style fixes (cherry picked from commit 22aa3d2) (cherry-picked to staging by puneetlath)
1 parent c1e5eb8 commit f355b20

7 files changed

Lines changed: 28 additions & 6 deletions

File tree

src/components/SelectionList/ListItem/InviteMemberListItem.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import PressableWithFeedback from '@components/Pressable/PressableWithFeedback';
55
import {useProductTrainingContext} from '@components/ProductTrainingContext';
66
import ReportActionAvatars from '@components/ReportActionAvatars';
77
import SelectCircle from '@components/SelectCircle';
8+
import {ListItemFocusContext} from '@components/SelectionList/ListItemFocusContext';
89
import Text from '@components/Text';
910
import TextWithTooltip from '@components/TextWithTooltip';
1011
import EducationalTooltip from '@components/Tooltip/EducationalTooltip';
@@ -153,7 +154,7 @@ function InviteMemberListItem<TItem extends ListItem>({
153154
/>
154155
)}
155156
</View>
156-
{!!item.rightElement && item.rightElement}
157+
{!!item.rightElement && <ListItemFocusContext.Provider value={{isFocused}}>{item.rightElement}</ListItemFocusContext.Provider>}
157158
{!!shouldShowCheckBox && (
158159
<PressableWithFeedback
159160
onPress={handleCheckboxPress}

src/components/SelectionList/ListItem/UserListItem.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type {OnyxEntry} from 'react-native-onyx';
55
import Icon from '@components/Icon';
66
import PressableWithFeedback from '@components/Pressable/PressableWithFeedback';
77
import ReportActionAvatars from '@components/ReportActionAvatars';
8+
import {ListItemFocusContext} from '@components/SelectionList/ListItemFocusContext';
89
import Text from '@components/Text';
910
import TextWithTooltip from '@components/TextWithTooltip';
1011
import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset';
@@ -162,7 +163,7 @@ function UserListItem<TItem extends ListItem>({
162163
/>
163164
)}
164165
</View>
165-
{!!item.rightElement && item.rightElement}
166+
{!!item.rightElement && <ListItemFocusContext.Provider value={{isFocused}}>{item.rightElement}</ListItemFocusContext.Provider>}
166167
{!!item.shouldShowRightCaret && (
167168
<View style={[styles.popoverMenuIcon, styles.pointerEventsAuto, isDisabled && styles.cursorDisabled]}>
168169
<Icon
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import {createContext, useContext} from 'react';
2+
3+
type ListItemFocusContextValue = {
4+
isFocused?: boolean;
5+
};
6+
7+
const ListItemFocusContext = createContext<ListItemFocusContextValue>({isFocused: false});
8+
9+
function useListItemFocus() {
10+
return useContext(ListItemFocusContext);
11+
}
12+
13+
export {ListItemFocusContext, useListItemFocus};

src/components/SelectionListWithSections/InviteMemberListItem.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import PressableWithFeedback from '@components/Pressable/PressableWithFeedback';
55
import {useProductTrainingContext} from '@components/ProductTrainingContext';
66
import ReportActionAvatars from '@components/ReportActionAvatars';
77
import SelectCircle from '@components/SelectCircle';
8+
import {ListItemFocusContext} from '@components/SelectionList/ListItemFocusContext';
89
import Text from '@components/Text';
910
import TextWithTooltip from '@components/TextWithTooltip';
1011
import EducationalTooltip from '@components/Tooltip/EducationalTooltip';
@@ -150,14 +151,15 @@ function InviteMemberListItem<TItem extends ListItem>({
150151
/>
151152
)}
152153
</View>
153-
{!!item.rightElement && item.rightElement}
154+
{!!item.rightElement && <ListItemFocusContext.Provider value={{isFocused}}>{item.rightElement}</ListItemFocusContext.Provider>}
154155
{!!shouldShowCheckBox && (
155156
<PressableWithFeedback
156157
onPress={handleCheckboxPress}
157158
disabled={isDisabled}
158159
role={CONST.ROLE.BUTTON}
159160
accessibilityLabel={item.text ?? ''}
160161
style={[styles.ml2, styles.optionSelectCircle]}
162+
sentryLabel={CONST.SENTRY_LABEL.LIST_ITEM.INVITE_MEMBER_CHECKBOX}
161163
>
162164
<SelectCircle
163165
isChecked={item.isSelected ?? false}

src/components/SelectionListWithSections/Search/ActionCell/BadgeActionCell.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function BadgeActionCell({action, isLargeScreenWidth, shouldDisablePointerEvents
2323
const StyleUtils = useStyleUtils();
2424
const text = translate(actionTranslationsMap[action]);
2525

26-
const badgeTheme = action === CONST.SEARCH.ACTION_TYPES.PAID ? theme.reportStatusBadge.paid : theme.reportStatusBadge.approved;
26+
const badgeTheme = action === CONST.SEARCH.ACTION_TYPES.PAID ? theme.reportStatusBadge.paid : theme.reportStatusBadge.closed;
2727

2828
return (
2929
<View

src/components/SelectionListWithSections/UserListItem.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {View} from 'react-native';
44
import Icon from '@components/Icon';
55
import PressableWithFeedback from '@components/Pressable/PressableWithFeedback';
66
import ReportActionAvatars from '@components/ReportActionAvatars';
7+
import {ListItemFocusContext} from '@components/SelectionList/ListItemFocusContext';
78
import Text from '@components/Text';
89
import TextWithTooltip from '@components/TextWithTooltip';
910
import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset';
@@ -160,7 +161,7 @@ function UserListItem<TItem extends ListItem>({
160161
/>
161162
)}
162163
</View>
163-
{!!item.rightElement && item.rightElement}
164+
{!!item.rightElement && <ListItemFocusContext.Provider value={{isFocused}}>{item.rightElement}</ListItemFocusContext.Provider>}
164165
{!!item.shouldShowRightIcon && (
165166
<View style={[styles.popoverMenuIcon, styles.pointerEventsAuto, isDisabled && styles.cursorDisabled]}>
166167
<Icon

src/pages/workspace/MemberRightIcon.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import React from 'react';
22
import type {StyleProp, ViewStyle} from 'react-native';
33
import Badge from '@components/Badge';
4+
import {useListItemFocus} from '@components/SelectionList/ListItemFocusContext';
45
import useLocalize from '@hooks/useLocalize';
6+
import useThemeStyles from '@hooks/useThemeStyles';
57
import CONST from '@src/CONST';
68
import type {TranslationPaths} from '@src/languages/types';
79

@@ -14,6 +16,8 @@ type MemberRightIconProps = {
1416

1517
export default function MemberRightIcon({role, owner, login, badgeStyles}: MemberRightIconProps) {
1618
const {translate} = useLocalize();
19+
const styles = useThemeStyles();
20+
const {isFocused} = useListItemFocus();
1721

1822
let badgeText: TranslationPaths | undefined;
1923
if (owner && owner === login) {
@@ -27,7 +31,7 @@ export default function MemberRightIcon({role, owner, login, badgeStyles}: Membe
2731
return (
2832
<Badge
2933
text={translate(badgeText)}
30-
badgeStyles={badgeStyles}
34+
badgeStyles={[isFocused && styles.badgeDefaultActive, badgeStyles]}
3135
/>
3236
);
3337
}

0 commit comments

Comments
 (0)