@@ -9,19 +9,21 @@ const {width: dimensionWidth} = Dimensions.get('window');
99interface NewEventTime {
1010 hour : number ;
1111 minutes : number ;
12+ date ?: string ;
1213}
1314
1415export interface TimelineHoursProps {
1516 start ?: number ;
1617 end ?: number ;
18+ date ?: string ;
1719 format24h ?: boolean ;
18- onBackgroundLongPress ?: ( timeString : string , time : { hour : number ; minutes : number } ) => void ;
19- onBackgroundLongPressOut ?: ( timeString : string , time : { hour : number ; minutes : number } ) => void ;
20+ onBackgroundLongPress ?: ( timeString : string , time : NewEventTime ) => void ;
21+ onBackgroundLongPressOut ?: ( timeString : string , time : NewEventTime ) => void ;
2022 styles : { [ key : string ] : ViewStyle | TextStyle } ;
2123}
2224
2325const TimelineHours = ( props : TimelineHoursProps ) => {
24- const { format24h, start = 0 , end = 24 , styles, onBackgroundLongPress, onBackgroundLongPressOut} = props ;
26+ const { format24h, start = 0 , end = 24 , date , styles, onBackgroundLongPress, onBackgroundLongPressOut} = props ;
2527
2628 const lastLongPressEventTime = useRef < NewEventTime > ( ) ;
2729 // const offset = this.calendarHeight / (end - start);
@@ -52,22 +54,22 @@ const TimelineHours = (props: TimelineHoursProps) => {
5254 const yPosition = event . nativeEvent . locationY ;
5355 const { hour, minutes} = calcTimeByPosition ( yPosition , HOUR_BLOCK_HEIGHT ) ;
5456
55- lastLongPressEventTime . current = { hour, minutes} ;
57+ lastLongPressEventTime . current = { hour, minutes, date } ;
5658
57- const timeString = buildTimeString ( hour , minutes ) ;
59+ const timeString = buildTimeString ( hour , minutes , date ) ;
5860 onBackgroundLongPress ?.( timeString , lastLongPressEventTime . current ) ;
5961 } ,
60- [ onBackgroundLongPress ]
62+ [ onBackgroundLongPress , date ]
6163 ) ;
6264
6365 const handlePressOut = useCallback ( ( ) => {
6466 if ( lastLongPressEventTime . current ) {
65- const { hour, minutes} = lastLongPressEventTime . current ;
66- const timeString = buildTimeString ( hour , minutes ) ;
67+ const { hour, minutes, date } = lastLongPressEventTime . current ;
68+ const timeString = buildTimeString ( hour , minutes , date ) ;
6769 onBackgroundLongPressOut ?.( timeString , lastLongPressEventTime . current ) ;
6870 lastLongPressEventTime . current = undefined ;
6971 }
70- } , [ onBackgroundLongPressOut ] ) ;
72+ } , [ onBackgroundLongPressOut , date ] ) ;
7173
7274 return (
7375 < >
0 commit comments