handled correct time slots
This commit is contained in:
parent
19e4962ef8
commit
349d2a62ff
@ -120,15 +120,21 @@ const TimePicker = ({ label, onChange, interval = 10, value,checkInTime,checkOut
|
||||
}, [value, interval, onChange]);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
if (isOpen && time && slotRefs.current[time]) {
|
||||
const selectedSlot = slotRefs.current[time];
|
||||
selectedSlot.scrollIntoView({
|
||||
useEffect(() => {
|
||||
if (isOpen) {
|
||||
const slots = generateTimeSlots();
|
||||
const targetTime = slots.find(slot => slot.time === time && slot.isSelectable)
|
||||
? time
|
||||
: (slots.find(slot => slot.isSelectable)?.time || null);
|
||||
|
||||
if (targetTime && slotRefs.current[targetTime]) {
|
||||
slotRefs.current[targetTime].scrollIntoView({
|
||||
behavior: "smooth",
|
||||
block: "center",
|
||||
});
|
||||
}
|
||||
}, [isOpen, time]);
|
||||
}
|
||||
}, [isOpen, time]);
|
||||
|
||||
|
||||
return (
|
||||
|
Loading…
x
Reference in New Issue
Block a user