From d021a164adeacc0625ee36ce2a8eaece3d130851 Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Thu, 15 Feb 2024 22:08:23 +0700 Subject: [PATCH 1/3] fix logic get year --- src/CONST.ts | 2 +- src/components/DatePicker/CalendarPicker/YearPickerModal.tsx | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index 5c99c5877559..bfbe51e1f755 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -123,7 +123,7 @@ const CONST = { }, DATE_BIRTH: { - MIN_AGE: 5, + MIN_AGE: 0, MIN_AGE_FOR_PAYMENT: 18, MAX_AGE: 150, }, diff --git a/src/components/DatePicker/CalendarPicker/YearPickerModal.tsx b/src/components/DatePicker/CalendarPicker/YearPickerModal.tsx index 21c57f79f39c..cf1c5fd7ab93 100644 --- a/src/components/DatePicker/CalendarPicker/YearPickerModal.tsx +++ b/src/components/DatePicker/CalendarPicker/YearPickerModal.tsx @@ -33,7 +33,7 @@ function YearPickerModal({isVisible, years, currentYear = new Date().getFullYear const yearsList = searchText === '' ? years : years.filter((year) => year.text.includes(searchText)); return { headerMessage: !yearsList.length ? translate('common.noResultsFound') : '', - sections: [{data: yearsList, indexOffset: 0}], + sections: [{data: yearsList.reverse(), indexOffset: 0}], }; }, [years, searchText, translate]); @@ -78,6 +78,7 @@ function YearPickerModal({isVisible, years, currentYear = new Date().getFullYear initiallyFocusedOptionKey={currentYear.toString()} showScrollIndicator shouldStopPropagation + shouldUseDynamicMaxToRenderPerBatch /> From 61da75db8096e5026a4c26cf19e495b50e3c7318 Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Tue, 20 Feb 2024 11:37:25 +0700 Subject: [PATCH 2/3] fix: show most recent year --- src/components/DatePicker/CalendarPicker/YearPickerModal.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/DatePicker/CalendarPicker/YearPickerModal.tsx b/src/components/DatePicker/CalendarPicker/YearPickerModal.tsx index cf1c5fd7ab93..69cd1e461ae7 100644 --- a/src/components/DatePicker/CalendarPicker/YearPickerModal.tsx +++ b/src/components/DatePicker/CalendarPicker/YearPickerModal.tsx @@ -33,7 +33,7 @@ function YearPickerModal({isVisible, years, currentYear = new Date().getFullYear const yearsList = searchText === '' ? years : years.filter((year) => year.text.includes(searchText)); return { headerMessage: !yearsList.length ? translate('common.noResultsFound') : '', - sections: [{data: yearsList.reverse(), indexOffset: 0}], + sections: [{data: yearsList.sort((a,b)=> b.value - a.value), indexOffset: 0}], }; }, [years, searchText, translate]); From dc45f0a121d3ce6857ffc971b31956a3043746a1 Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Tue, 20 Feb 2024 11:43:10 +0700 Subject: [PATCH 3/3] fix lint --- src/components/DatePicker/CalendarPicker/YearPickerModal.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/DatePicker/CalendarPicker/YearPickerModal.tsx b/src/components/DatePicker/CalendarPicker/YearPickerModal.tsx index 69cd1e461ae7..dbd67403c639 100644 --- a/src/components/DatePicker/CalendarPicker/YearPickerModal.tsx +++ b/src/components/DatePicker/CalendarPicker/YearPickerModal.tsx @@ -33,7 +33,7 @@ function YearPickerModal({isVisible, years, currentYear = new Date().getFullYear const yearsList = searchText === '' ? years : years.filter((year) => year.text.includes(searchText)); return { headerMessage: !yearsList.length ? translate('common.noResultsFound') : '', - sections: [{data: yearsList.sort((a,b)=> b.value - a.value), indexOffset: 0}], + sections: [{data: yearsList.sort((a, b) => b.value - a.value), indexOffset: 0}], }; }, [years, searchText, translate]);