@@ -52,7 +52,6 @@ const BasicDay = (props: BasicDayProps) => {
5252 testID
5353 } = props ;
5454 const style = useRef ( styleConstructor ( theme ) ) ;
55- const dateData = useRef ( date ? xdateToData ( new XDate ( date ) ) : undefined ) ;
5655 const _marking = marking || { } ;
5756 const isSelected = _marking . selected || state === 'selected' ;
5857 const isDisabled = typeof _marking . disabled !== 'undefined' ? _marking . disabled : state === 'disabled' ;
@@ -61,6 +60,7 @@ const BasicDay = (props: BasicDayProps) => {
6160 const isMultiDot = markingType === Marking . markings . MULTI_DOT ;
6261 const isMultiPeriod = markingType === Marking . markings . MULTI_PERIOD ;
6362 const isCustom = markingType === Marking . markings . CUSTOM ;
63+ const dateData = date ? xdateToData ( new XDate ( date ) ) : undefined ;
6464
6565 const shouldDisableTouchEvent = ( ) => {
6666 const { disableTouchEvent} = _marking ;
@@ -126,12 +126,12 @@ const BasicDay = (props: BasicDayProps) => {
126126 } ;
127127
128128 const _onPress = useCallback ( ( ) => {
129- onPress ?.( dateData . current ) ;
130- } , [ onPress ] ) ;
129+ onPress ?.( dateData ) ;
130+ } , [ onPress , date ] ) ;
131131
132132 const _onLongPress = useCallback ( ( ) => {
133- onLongPress ?.( dateData . current ) ;
134- } , [ onLongPress ] ) ;
133+ onLongPress ?.( dateData ) ;
134+ } , [ onLongPress , date ] ) ;
135135
136136 const renderMarking = ( ) => {
137137 const { marked, dotColor, dots, periods} = _marking ;
0 commit comments