Skip to content

Commit d5389af

Browse files
committed
Wrap closeCalendar with useCallback. When calendar closed make knob press opaque
1 parent 27d4648 commit d5389af

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/expandableCalendar/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -405,14 +405,14 @@ const ExpandableCalendar = (props: ExpandableCalendarProps) => {
405405
}
406406
};
407407

408-
const closeCalendar = () => {
408+
const closeCalendar = useCallback(() => {
409409
setTimeout(() => {
410410
// to allows setDate to be completed
411411
if (isOpen) {
412412
bounceToPosition(closedHeight);
413413
}
414414
}, 0);
415-
};
415+
}, [isOpen]);
416416

417417
/** Events */
418418

@@ -516,7 +516,7 @@ const ExpandableCalendar = (props: ExpandableCalendarProps) => {
516516
const renderKnob = () => {
517517
return (
518518
<View style={style.current.knobContainer} testID={`${testID}-knob`} pointerEvents={'box-none'}>
519-
<TouchableOpacity style={style.current.knob} testID={CALENDAR_KNOB} onPress={closeCalendar} hitSlop={knobHitSlop}/>
519+
<TouchableOpacity style={style.current.knob} testID={CALENDAR_KNOB} onPress={closeCalendar} hitSlop={knobHitSlop} activeOpacity={!isOpen ? 1 : undefined}/>
520520
</View>
521521
);
522522
};

0 commit comments

Comments
 (0)