@@ -4,7 +4,7 @@ import {FlashListPackage} from 'optionalDeps';
4
4
import { Constants } from '../../commons/new' ;
5
5
import { generateMonthItems } from './helpers/CalendarProcessor' ;
6
6
import { addHeaders } from './helpers/DataProcessor' ;
7
- import { isSameMonth , addYears , getDateObject } from './helpers/DateUtils' ;
7
+ import { isSameMonth , /* addYears, */ getDateObject } from './helpers/DateUtils' ;
8
8
import { CalendarContextProps , CalendarProps , FirstDayOfWeek , UpdateSource , DateObjectWithOptionalDay } from './types' ;
9
9
import CalendarContext from './CalendarContext' ;
10
10
import CalendarItem from './CalendarItem' ;
@@ -32,7 +32,7 @@ function Calendar(props: PropsWithChildren<CalendarProps>) {
32
32
} = props ;
33
33
34
34
const initialItems = generateMonthItems ( initialDate , YEARS_RANGE , YEARS_RANGE ) ;
35
- const [ items , setItems ] = useState < DateObjectWithOptionalDay [ ] > ( initialItems ) ;
35
+ const [ items /* , setItems */ ] = useState < DateObjectWithOptionalDay [ ] > ( initialItems ) ;
36
36
37
37
const getItemIndex = useCallback ( ( date : number ) => {
38
38
'worklet' ;
@@ -101,26 +101,27 @@ function Calendar(props: PropsWithChildren<CalendarProps>) {
101
101
102
102
/** Pages reload */
103
103
104
- const mergeArrays = ( prepend : boolean , array : DateObjectWithOptionalDay [ ] , newArray : DateObjectWithOptionalDay [ ] ) => {
105
- const arr : DateObjectWithOptionalDay [ ] = array . slice ( ) ;
106
- if ( prepend ) {
107
- arr . unshift ( ...newArray ) ;
108
- } else {
109
- arr . push ( ...newArray ) ;
110
- }
111
- return arr ;
112
- } ;
113
-
114
- const addPages = useCallback ( ( index : number ) => {
115
- const prepend = index < PAGE_RELOAD_THRESHOLD ;
116
- const append = index > items . length - PAGE_RELOAD_THRESHOLD ;
117
- const pastRange = prepend ? YEARS_RANGE : 0 ;
118
- const futureRange = append ? YEARS_RANGE : 0 ;
119
- const newDate = addYears ( current . value , prepend ? - 1 : 1 ) ;
120
- const newItems = generateMonthItems ( newDate , pastRange , futureRange ) ;
121
- const newArray = mergeArrays ( prepend , items , newItems ) ;
122
- setItems ( newArray ) ;
123
- // eslint-disable-next-line react-hooks/exhaustive-deps
104
+ // const mergeArrays = (prepend: boolean, array: DateObjectWithOptionalDay[], newArray: DateObjectWithOptionalDay[]) => {
105
+ // const arr: DateObjectWithOptionalDay[] = array.slice();
106
+ // if (prepend) {
107
+ // arr.unshift(...newArray);
108
+ // } else {
109
+ // arr.push(...newArray);
110
+ // }
111
+ // return arr;
112
+ // };
113
+
114
+ const addPages = useCallback ( ( /* index: number */ ) => {
115
+
116
+ // const prepend = index < PAGE_RELOAD_THRESHOLD;
117
+ // const append = index > items.length - PAGE_RELOAD_THRESHOLD;
118
+ // const pastRange = prepend ? YEARS_RANGE : 0;
119
+ // const futureRange = append ? YEARS_RANGE : 0;
120
+ // const newDate = addYears(current.value, prepend ? -1 : 1);
121
+ // const newItems = generateMonthItems(newDate, pastRange, futureRange);
122
+ // const newArray = mergeArrays(prepend, items, newItems);
123
+ // setItems(newArray);
124
+ // // eslint-disable-next-line react-hooks/exhaustive-deps
124
125
} , [ items ] ) ;
125
126
126
127
const shouldAddPages = useCallback ( ( index : number ) => {
@@ -138,7 +139,7 @@ function Calendar(props: PropsWithChildren<CalendarProps>) {
138
139
139
140
if ( shouldAddPages ( index ) ) {
140
141
console . log ( 'Add new pages: ' , index , items . length ) ;
141
- runOnJS ( addPages ) ( index ) ;
142
+ runOnJS ( addPages ) ( /* index */ ) ;
142
143
} else if ( lastUpdateSource . value !== UpdateSource . MONTH_SCROLL ) {
143
144
if ( previous && ! isSameMonth ( selected , previous ) ) {
144
145
runOnJS ( scrollToIndex ) ( index ) ;
0 commit comments