Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 0 additions & 6 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2062,12 +2062,6 @@ const ROUTES = {
// eslint-disable-next-line no-restricted-syntax -- Legacy route generation
getRoute: (policyID: string, feed: string, backTo?: string) => getUrlWithBackToParam(`workspaces/${policyID}/company-cards/${feed}/assign-card`, backTo),
},
WORKSPACE_COMPANY_CARDS_TRANSACTION_START_DATE: {
route: 'workspaces/:policyID/company-cards/:feed/assign-card/transaction-start-date',

// eslint-disable-next-line no-restricted-syntax -- Legacy route generation
getRoute: (policyID: string, feed: string, backTo?: string) => getUrlWithBackToParam(`workspaces/${policyID}/company-cards/${feed}/assign-card/transaction-start-date`, backTo),
},
WORKSPACE_COMPANY_CARD_DETAILS: {
route: 'workspaces/:policyID/company-cards/:bank/:cardID',

Expand Down
1 change: 0 additions & 1 deletion src/SCREENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,6 @@ const SCREENS = {
PROFILE: 'Workspace_Overview',
COMPANY_CARDS: 'Workspace_CompanyCards',
COMPANY_CARDS_ASSIGN_CARD: 'Workspace_CompanyCards_AssignCard',
COMPANY_CARDS_TRANSACTION_START_DATE: 'Workspace_CompanyCards_TransactionStartDate',
COMPANY_CARDS_SELECT_FEED: 'Workspace_CompanyCards_Select_Feed',
COMPANY_CARDS_BANK_CONNECTION: 'Workspace_CompanyCards_BankConnection',
COMPANY_CARDS_ADD_NEW: 'Workspace_CompanyCards_New',
Expand Down
2 changes: 2 additions & 0 deletions src/components/SelectionList/BaseSelectionList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ function BaseSelectionList<TItem extends ListItem>({
shouldSingleExecuteRowSelect = false,
shouldPreventDefaultFocusOnSelectRow = false,
shouldShowTextInput = !!textInputOptions?.label,
shouldHighlightSelectedItem = true,
}: SelectionListProps<TItem>) {
const styles = useThemeStyles();
const isFocused = useIsFocused();
Expand Down Expand Up @@ -324,6 +325,7 @@ function BaseSelectionList<TItem extends ListItem>({
wrapperStyle={style?.listItemWrapperStyle}
titleStyles={style?.listItemTitleStyles}
singleExecution={singleExecution}
shouldHighlightSelectedItem={shouldHighlightSelectedItem}
shouldSyncFocus={!isTextInputFocusedRef.current && hasKeyBeenPressed.current}
/>
);
Expand Down
9 changes: 7 additions & 2 deletions src/components/SelectionList/ListItem/BaseListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ function BaseListItem<TItem extends ListItem>({
onLongPressRow,
testID,
shouldUseDefaultRightHandSideCheckmark = true,
shouldHighlightSelectedItem = true,
}: BaseListItemProps<TItem>) {
const theme = useTheme();
const styles = useThemeStyles();
Expand Down Expand Up @@ -108,7 +109,9 @@ function BaseListItem<TItem extends ListItem>({
id={keyForList ?? ''}
style={[
pressableStyle,
isFocused && StyleUtils.getItemBackgroundColorStyle(!!item.isSelected, !!isFocused, !!item.isDisabled, theme.activeComponentBG, theme.hoverComponentBG),
isFocused &&
shouldHighlightSelectedItem &&
StyleUtils.getItemBackgroundColorStyle(!!item.isSelected, !!isFocused, !!item.isDisabled, theme.activeComponentBG, theme.hoverComponentBG),
]}
onFocus={onFocus}
onMouseLeave={handleMouseLeave}
Expand All @@ -121,7 +124,9 @@ function BaseListItem<TItem extends ListItem>({
accessibilityState={{selected: !!isFocused}}
style={[
wrapperStyle,
isFocused && StyleUtils.getItemBackgroundColorStyle(!!item.isSelected, !!isFocused, !!item.isDisabled, theme.activeComponentBG, theme.hoverComponentBG),
isFocused &&
shouldHighlightSelectedItem &&
StyleUtils.getItemBackgroundColorStyle(!!item.isSelected, !!isFocused, !!item.isDisabled, theme.activeComponentBG, theme.hoverComponentBG),
]}
>
{typeof children === 'function' ? children(hovered) : children}
Expand Down
3 changes: 3 additions & 0 deletions src/components/SelectionList/ListItem/ListItemRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type ListItemRendererProps<TItem extends ListItem> = Omit<BaseListItemProps<TIte
singleExecution: ReturnType<typeof useSingleExecution>['singleExecution'];
titleStyles?: StyleProp<TextStyle>;
titleContainerStyles?: StyleProp<ViewStyle>;
shouldHighlightSelectedItem: boolean;
};

function ListItemRenderer<TItem extends ListItem>({
Expand Down Expand Up @@ -45,6 +46,7 @@ function ListItemRenderer<TItem extends ListItem>({
singleExecution,
titleContainerStyles,
shouldUseDefaultRightHandSideCheckmark,
shouldHighlightSelectedItem,
}: ListItemRendererProps<TItem>) {
const handleOnCheckboxPress = () => {
if (isTransactionGroupListItemType(item)) {
Expand Down Expand Up @@ -95,6 +97,7 @@ function ListItemRenderer<TItem extends ListItem>({
titleStyles={titleStyles}
titleContainerStyles={titleContainerStyles}
shouldUseDefaultRightHandSideCheckmark={shouldUseDefaultRightHandSideCheckmark}
shouldHighlightSelectedItem={shouldHighlightSelectedItem}
/>
{item.footerContent && item.footerContent}
</>
Expand Down
2 changes: 2 additions & 0 deletions src/components/SelectionList/ListItem/RadioListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ function RadioListItem<TItem extends ListItem>({
shouldSyncFocus,
wrapperStyle,
titleStyles,
shouldHighlightSelectedItem = true,
}: RadioListItemProps<TItem>) {
const styles = useThemeStyles();
const fullTitle = isMultilineSupported ? item.text?.trimStart() : item.text;
Expand All @@ -45,6 +46,7 @@ function RadioListItem<TItem extends ListItem>({
onFocus={onFocus}
shouldSyncFocus={shouldSyncFocus}
pendingAction={item.pendingAction}
shouldHighlightSelectedItem={shouldHighlightSelectedItem}
>
<>
{!!item.leftElement && item.leftElement}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ function SingleSelectListItem<TItem extends ListItem>({
shouldSyncFocus,
wrapperStyle,
titleStyles,
shouldHighlightSelectedItem = true,
}: SingleSelectListItemProps<TItem>) {
const styles = useThemeStyles();

Expand Down Expand Up @@ -56,6 +57,7 @@ function SingleSelectListItem<TItem extends ListItem>({
shouldSyncFocus={shouldSyncFocus}
wrapperStyle={[wrapperStyle, styles.optionRowCompact]}
titleStyles={titleStyles}
shouldHighlightSelectedItem={shouldHighlightSelectedItem}
/>
);
}
Expand Down
5 changes: 5 additions & 0 deletions src/components/SelectionList/ListItem/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,9 @@ type ListItemProps<TItem extends ListItem> = CommonListItemProps<TItem> & {

/** Whether to show the default right hand side checkmark */
shouldUseDefaultRightHandSideCheckmark?: boolean;

/** Whether to highlight the selected item */
shouldHighlightSelectedItem?: boolean;
};

type ValidListItem =
Expand Down Expand Up @@ -263,6 +266,8 @@ type BaseListItemProps<TItem extends ListItem> = CommonListItemProps<TItem> & {
shouldUseDefaultRightHandSideCheckmark?: boolean;
/** Whether to show the right caret icon */
shouldShowRightCaret?: boolean;
/** Whether to highlight the selected item */
shouldHighlightSelectedItem?: boolean;
};
type RadioListItemProps<TItem extends ListItem> = ListItemProps<TItem>;

Expand Down
3 changes: 3 additions & 0 deletions src/components/SelectionList/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ type SelectionListProps<TItem extends ListItem> = {

/** Whether to show the text input */
shouldShowTextInput?: boolean;

/** Whether to highlight the selected item */
shouldHighlightSelectedItem?: boolean;
};

type TextInputOptions = {
Expand Down
9 changes: 7 additions & 2 deletions src/components/SelectionListWithSections/BaseListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ function BaseListItem<TItem extends ListItem>({
shouldUseDefaultRightHandSideCheckmark = true,
forwardedFSClass,
shouldShowRightCaret = false,
shouldHighlightSelectedItem = true,
}: BaseListItemProps<TItem>) {
const theme = useTheme();
const styles = useThemeStyles();
Expand Down Expand Up @@ -110,7 +111,9 @@ function BaseListItem<TItem extends ListItem>({
id={keyForList ?? ''}
style={[
pressableStyle,
isFocused && StyleUtils.getItemBackgroundColorStyle(!!item.isSelected, !!isFocused, !!item.isDisabled, theme.activeComponentBG, theme.hoverComponentBG),
isFocused &&
shouldHighlightSelectedItem &&
StyleUtils.getItemBackgroundColorStyle(!!item.isSelected, !!isFocused, !!item.isDisabled, theme.activeComponentBG, theme.hoverComponentBG),
]}
onFocus={onFocus}
onMouseLeave={handleMouseLeave}
Expand All @@ -123,7 +126,9 @@ function BaseListItem<TItem extends ListItem>({
accessibilityState={{selected: !!isFocused}}
style={[
wrapperStyle,
isFocused && StyleUtils.getItemBackgroundColorStyle(!!item.isSelected, !!isFocused, !!item.isDisabled, theme.activeComponentBG, theme.hoverComponentBG),
isFocused &&
shouldHighlightSelectedItem &&
StyleUtils.getItemBackgroundColorStyle(!!item.isSelected, !!isFocused, !!item.isDisabled, theme.activeComponentBG, theme.hoverComponentBG),
]}
fsClass={forwardedFSClass}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ function BaseSelectionListItemRenderer<TItem extends ListItem>({
personalDetails,
userBillingFundID,
shouldShowRightCaret,
shouldHighlightSelectedItem = true,
}: BaseSelectionListItemRendererProps<TItem>) {
const handleOnCheckboxPress = () => {
if (isTransactionGroupListItemType(item)) {
Expand Down Expand Up @@ -115,6 +116,7 @@ function BaseSelectionListItemRenderer<TItem extends ListItem>({
userBillingFundID={userBillingFundID}
index={index}
shouldShowRightCaret={shouldShowRightCaret}
shouldHighlightSelectedItem={shouldHighlightSelectedItem}
sectionIndex={sectionIndex}
/>
{item.footerContent && item.footerContent}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ function BaseSelectionListWithSections<TItem extends ListItem>({
canShowProductTrainingTooltip,
renderScrollComponent,
shouldShowRightCaret,
shouldHighlightSelectedItem = true,
ref,
}: SelectionListProps<TItem>) {
const styles = useThemeStyles();
Expand Down Expand Up @@ -649,6 +650,7 @@ function BaseSelectionListWithSections<TItem extends ListItem>({
isSelected: selected,
...item,
}}
shouldHighlightSelectedItem={shouldHighlightSelectedItem}
shouldUseDefaultRightHandSideCheckmark={shouldUseDefaultRightHandSideCheckmark}
index={index}
sectionIndex={section?.indexOffset}
Expand Down
2 changes: 2 additions & 0 deletions src/components/SelectionListWithSections/RadioListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ function RadioListItem<TItem extends ListItem>({
shouldSyncFocus,
wrapperStyle,
titleStyles,
shouldHighlightSelectedItem = true,
}: RadioListItemProps<TItem>) {
const styles = useThemeStyles();
const fullTitle = isMultilineSupported ? item.text?.trimStart() : item.text;
Expand All @@ -45,6 +46,7 @@ function RadioListItem<TItem extends ListItem>({
onFocus={onFocus}
shouldSyncFocus={shouldSyncFocus}
pendingAction={item.pendingAction}
shouldHighlightSelectedItem={shouldHighlightSelectedItem}
>
<>
{!!item.leftElement && item.leftElement}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ function SingleSelectListItem<TItem extends ListItem>({
shouldSyncFocus,
wrapperStyle,
titleStyles,
shouldHighlightSelectedItem = true,
}: SingleSelectListItemProps<TItem>) {
const styles = useThemeStyles();
const isSelected = item.isSelected;
Expand Down Expand Up @@ -56,6 +57,7 @@ function SingleSelectListItem<TItem extends ListItem>({
shouldSyncFocus={shouldSyncFocus}
wrapperStyle={[wrapperStyle, styles.optionRowCompact]}
titleStyles={titleStyles}
shouldHighlightSelectedItem={shouldHighlightSelectedItem}
/>
);
}
Expand Down
6 changes: 6 additions & 0 deletions src/components/SelectionListWithSections/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ type CommonListItemProps<TItem extends ListItem> = {

/** Whether to show the right caret */
shouldShowRightCaret?: boolean;

/** Whether to highlight the selected item */
shouldHighlightSelectedItem?: boolean;
} & TRightHandSideComponent<TItem>;

type ListItemFocusEventHandler = (event: NativeSyntheticEvent<ExtendedTargetedEvent>) => void;
Expand Down Expand Up @@ -949,6 +952,9 @@ type SelectionListProps<TItem extends ListItem> = Partial<ChildrenProps> & {

/** Whether to show the right caret icon */
shouldShowRightCaret?: boolean;

/** Whether to highlight the selected item */
shouldHighlightSelectedItem?: boolean;
} & TRightHandSideComponent<TItem>;

type SelectionListHandle = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -683,8 +683,6 @@ const SettingsModalStackNavigator = createModalStackNavigator<SettingsNavigatorP
[SCREENS.WORKSPACE.COMPANY_CARDS_SELECT_FEED]: () => require<ReactComponentModule>('../../../../pages/workspace/companyCards/WorkspaceCompanyCardFeedSelectorPage').default,
[SCREENS.WORKSPACE.COMPANY_CARDS_BANK_CONNECTION]: () => require<ReactComponentModule>('../../../../pages/workspace/companyCards/BankConnection').default,
[SCREENS.WORKSPACE.COMPANY_CARDS_ADD_NEW]: () => require<ReactComponentModule>('../../../../pages/workspace/companyCards/addNew/AddNewCardPage').default,
[SCREENS.WORKSPACE.COMPANY_CARDS_TRANSACTION_START_DATE]: () =>
require<ReactComponentModule>('../../../../pages/workspace/companyCards/assignCard/TransactionStartDateSelectorPage').default,
[SCREENS.WORKSPACE.COMPANY_CARD_DETAILS]: () => require<ReactComponentModule>('../../../../pages/workspace/companyCards/WorkspaceCompanyCardDetailsPage').default,
[SCREENS.WORKSPACE.COMPANY_CARD_NAME]: () => require<ReactComponentModule>('../../../../pages/workspace/companyCards/WorkspaceCompanyCardEditCardNamePage').default,
[SCREENS.WORKSPACE.COMPANY_CARD_EXPORT]: () => require<ReactComponentModule>('../../../../pages/workspace/companyCards/WorkspaceCompanyCardAccountSelectCardPage').default,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ const WORKSPACE_TO_RHP: Partial<Record<keyof WorkspaceSplitNavigatorParamList, s
SCREENS.WORKSPACE.COMPANY_CARD_DETAILS,
SCREENS.WORKSPACE.COMPANY_CARD_NAME,
SCREENS.WORKSPACE.COMPANY_CARD_EXPORT,
SCREENS.WORKSPACE.COMPANY_CARDS_TRANSACTION_START_DATE,
],
[SCREENS.WORKSPACE.EXPENSIFY_CARD]: [
SCREENS.WORKSPACE.EXPENSIFY_CARD_ISSUE_NEW,
Expand Down
3 changes: 0 additions & 3 deletions src/libs/Navigation/linkingConfig/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -739,9 +739,6 @@ const config: LinkingOptions<RootNavigatorParamList>['config'] = {
[SCREENS.WORKSPACE.COMPANY_CARDS_ASSIGN_CARD]: {
path: ROUTES.WORKSPACE_COMPANY_CARDS_ASSIGN_CARD.route,
},
[SCREENS.WORKSPACE.COMPANY_CARDS_TRANSACTION_START_DATE]: {
path: ROUTES.WORKSPACE_COMPANY_CARDS_TRANSACTION_START_DATE.route,
},
[SCREENS.WORKSPACE.INVITE]: {
path: ROUTES.WORKSPACE_INVITE.route,
},
Expand Down
6 changes: 0 additions & 6 deletions src/libs/Navigation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2203,12 +2203,6 @@ type WorkspaceSplitNavigatorParamList = {
// eslint-disable-next-line no-restricted-syntax -- `backTo` usages in this file are legacy. Do not add new `backTo` params to screens. See contributingGuides/NAVIGATION.md
backTo?: Routes;
};
[SCREENS.WORKSPACE.COMPANY_CARDS_TRANSACTION_START_DATE]: {
policyID: string;
feed: string;
// eslint-disable-next-line no-restricted-syntax -- `backTo` usages in this file are legacy. Do not add new `backTo` params to screens. See contributingGuides/NAVIGATION.md
backTo?: Routes;
};
[SCREENS.WORKSPACE.PER_DIEM]: {
policyID: string;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,7 @@ function AssignCardFeedPage({route, policy}: AssignCardFeedPageProps) {
/>
);
case CONST.COMPANY_CARD.STEP.TRANSACTION_START_DATE:
return (
<TransactionStartDateStep
policyID={policyID}
feed={feed}
backTo={backTo}
/>
);
return <TransactionStartDateStep />;
case CONST.COMPANY_CARD.STEP.CARD_NAME:
return <CardNameStep policyID={policyID} />;
case CONST.COMPANY_CARD.STEP.CONFIRMATION:
Expand Down
Loading
Loading