Replies: 2 comments
-
Yeah, I see what you mean - thanks for the detailed report. As a workaround, you could add a custom The following should work: <DayPicker
- disabled={disabledDays}
+ modifiers={{ disabled: disabledDays }
+ modifiersClassNames={{
+ disabled: 'rdp-disabled',
+ }}
/> Not sure about the fix to the DayPicker source code. Ideally, if you want a custom selection, you should not use I'll check out your sandbox and see if I can come up with a better solution! |
Beta Was this translation helpful? Give feedback.
-
Thanks, a custom modifier like this worked as well: <DayPicker
disabled={disabledDays}
{...(selectedRange?.from &&
!selectedRange?.to && {
modifiers: {
selectedFrom: [selectedRange.from],
},
modifiersClassNames: {
selectedFrom: 'rdp-selected !opacity-100',
},
})}
/> |
Beta Was this translation helpful? Give feedback.
-
Code
When using
onDayClick
for custom selection behavior, disabling thefrom
day after clicking it won't give it therdp-selected
class. This used to work in v8, there it got bothrdp-disabled
andrdp-selected
.See this codesandbox
Also note the empty function in
onSelect
, it's needed foronDayClick
to work since that makes the component controlled in v9.Expected Behavior
A disabled selected
from
day should have bothrdp-disabled
andrdp-selected
. So you can see the start of the selection even with the day being disabled.Actual Behavior
In v9,
rdp-selected
isn't added, so you don't see the start of the selection.Screenshots
Beta Was this translation helpful? Give feedback.
All reactions