@@ -186,7 +186,9 @@ const ExpandableCalendar = (props: ExpandableCalendarProps) => {
186186
187187 const [ position , setPosition ] = useState ( initialPosition || Positions . CLOSED ) ;
188188 const [ screenReaderEnabled , setScreenReaderEnabled ] = useState ( false ) ;
189- const isOpen = position === Positions . OPEN ;
189+ const isOpen = useMemo ( ( ) => {
190+ return position === Positions . OPEN ;
191+ } , [ position ] ) ;
190192
191193 /** Components' refs */
192194
@@ -294,6 +296,7 @@ const ExpandableCalendar = (props: ExpandableCalendarProps) => {
294296 const firstDayOfWeek = ( next ? 7 : - 7 ) - dayOfTheWeek + firstDay ;
295297 d . addDays ( firstDayOfWeek ) ;
296298 }
299+
297300 setDate ?.( toMarkingFormat ( d ) , updateSources . PAGE_SCROLL ) ;
298301 }
299302 } ;
@@ -365,16 +368,12 @@ const ExpandableCalendar = (props: ExpandableCalendarProps) => {
365368
366369 onCalendarToggled ?.( _isOpen ) ;
367370
368- _setPosition ( _height . current === closedHeight ) ;
371+ setPosition ( ( ) => _height . current === closedHeight ? Positions . CLOSED : Positions . OPEN ) ;
369372 closeHeader ( _isOpen ) ;
370373 resetWeekCalendarOpacity ( _isOpen ) ;
371374 }
372375 } ;
373376
374- const _setPosition = ( isClosed : boolean ) => {
375- setPosition ( isClosed ? Positions . CLOSED : Positions . OPEN ) ;
376- } ;
377-
378377 const resetWeekCalendarOpacity = ( isOpen : boolean ) => {
379378 _weekCalendarStyles . style . opacity = isOpen ? 0 : 1 ;
380379 updateNativeStyles ( ) ;
@@ -455,7 +454,7 @@ const ExpandableCalendar = (props: ExpandableCalendarProps) => {
455454 } ,
456455 100 ,
457456 { trailing : true , leading : false }
458- ) , [ date ] ) ;
457+ ) , [ date , scrollPage ] ) ;
459458
460459 /** Renders */
461460
0 commit comments