Skip to content

Commit 3c2a24d

Browse files
committed
added header message to custom close date selection list
1 parent 0b86ba3 commit 3c2a24d

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/pages/workspace/companyCards/WorkspaceCompanyCardStatementCloseDateSelectionList/CustomCloseDateSelectionList.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function CustomCloseDateSelectionList({initiallySelectedDay, onConfirmSelectedDa
2525
const [searchValue, debouncedSearchValue, setSearchValue] = useDebouncedState('');
2626
const [error, setError] = useState<string | undefined>(undefined);
2727

28-
const sections = useMemo(() => {
28+
const {sections, headerMessage} = useMemo(() => {
2929
const data = CONST.DATE.MONTH_DAYS.reduce<CustomCloseDateListItem[]>((days, dayValue) => {
3030
const day = {
3131
value: dayValue,
@@ -45,8 +45,11 @@ function CustomCloseDateSelectionList({initiallySelectedDay, onConfirmSelectedDa
4545
return days;
4646
}, []);
4747

48-
return [{data, indexOffset: 0}];
49-
}, [selectedDay, debouncedSearchValue]);
48+
return {
49+
sections: [{data, indexOffset: 0}],
50+
headerMessage: data.length === 0 ? translate('common.noResultsFound') : undefined,
51+
};
52+
}, [selectedDay, debouncedSearchValue, translate]);
5053

5154
const selectDayAndClearError = useCallback((item: CustomCloseDateListItem) => {
5255
setSelectedDay(item.value);
@@ -80,6 +83,7 @@ function CustomCloseDateSelectionList({initiallySelectedDay, onConfirmSelectedDa
8083
textInputLabel={translate('common.search')}
8184
textInputValue={searchValue}
8285
onChangeText={setSearchValue}
86+
headerMessage={headerMessage}
8387
>
8488
{!!error && (
8589
<FormHelpMessage

0 commit comments

Comments
 (0)