Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function CustomCloseDateSelectionList({initiallySelectedDay, onConfirmSelectedDa
const [searchValue, debouncedSearchValue, setSearchValue] = useDebouncedState('');
const [error, setError] = useState<string | undefined>(undefined);

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

return [{data, indexOffset: 0}];
}, [selectedDay, debouncedSearchValue]);
return {
sections: [{data, indexOffset: 0}],
headerMessage: data.length === 0 ? translate('common.noResultsFound') : undefined,
};
}, [selectedDay, debouncedSearchValue, translate]);

const selectDayAndClearError = useCallback((item: CustomCloseDateListItem) => {
setSelectedDay(item.value);
Expand Down Expand Up @@ -80,6 +83,7 @@ function CustomCloseDateSelectionList({initiallySelectedDay, onConfirmSelectedDa
textInputLabel={translate('common.search')}
textInputValue={searchValue}
onChangeText={setSearchValue}
headerMessage={headerMessage}
>
{!!error && (
<FormHelpMessage
Expand Down
Loading