@@ -191,22 +191,24 @@ const ExpandableCalendar = forwardRef<ExpandableCalendarRef, ExpandableCalendarP
191191
192192 const [ position , setPosition ] = useState ( numberOfDays ? Positions . CLOSED : initialPosition ) ;
193193 const isOpen = position === Positions . OPEN ;
194- const getOpenHeight = ( ) => {
194+ const getOpenHeight = useCallback ( ( ) => {
195195 if ( ! horizontal ) {
196196 return Math . max ( constants . screenHeight , constants . screenWidth ) ;
197197 }
198198 return headerHeight + ( WEEK_HEIGHT * ( numberOfWeeks . current ) ) + ( hideKnob ? 0 : KNOB_CONTAINER_HEIGHT ) ;
199- } ;
199+ } , [ headerHeight , horizontal , hideKnob , numberOfWeeks ] ) ;
200+
200201 const openHeight = useRef ( getOpenHeight ( ) ) ;
201202 const closedHeight = useMemo ( ( ) => headerHeight + WEEK_HEIGHT + ( hideKnob || Number ( numberOfDays ) > 1 ? 0 : KNOB_CONTAINER_HEIGHT ) , [ numberOfDays , hideKnob , headerHeight ] ) ;
202- const startHeight = useMemo ( ( ) => isOpen ? openHeight . current : closedHeight , [ closedHeight , isOpen ] ) ;
203+ const startHeight = useMemo ( ( ) => isOpen ? getOpenHeight ( ) : closedHeight , [ closedHeight , isOpen , getOpenHeight ] ) ;
203204 const _height = useRef ( startHeight ) ;
204205 const deltaY = useMemo ( ( ) => new Animated . Value ( startHeight ) , [ startHeight ] ) ;
205206 const headerDeltaY = useRef ( new Animated . Value ( isOpen ? - headerHeight : 0 ) ) ;
206207
207208 useEffect ( ( ) => {
208209 _height . current = startHeight ;
209210 deltaY . setValue ( startHeight ) ;
211+ _wrapperStyles . current . style . height = startHeight ;
210212 } , [ startHeight ] ) ;
211213
212214 useEffect ( ( ) => {
0 commit comments