How does useDayPicker or useActiveModifiers work? #1815
-
Hello I've got a setup like this (pseudo-code).
I want to get the modifiers of the daypicker onInputChange (to access them somewhere). I want to get access to the modifiers of the daypicker (selected, disabled, ...). And i thought useActiveModifiers can be used for that? But your documentation does not have examples and is pretty bare so almost nothing get's explained. Can I find any more information about the hooks, or the RootProvider and it's purpose, or anything. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
@wannesdebacker if I understand correctly, you want to know the modifiers of the date entered in the input field (e.g. is the typed date already selected?). Am I correct? Since you decide the logic of this modifiers, you should be able to tell by yourself in the code – without he need of the DayPicker hooks: https://codesandbox.io/s/react-daypicker-forked-hdwwrw?file=/src/App.tsx DayPicker hooks are for custom components. If you want for some reason use these hooks, you need to place your input field in a custom component, such a Caption or a Footer. There the hooks are accessible (you can import the original component as well): https://codesandbox.io/s/react-daypicker-forked-gdjnxx?file=/src/App.tsx
Public exports are documented in https://react-day-picker.js.org/api/modules, other components such the |
Beta Was this translation helpful? Give feedback.
-
@gpbl So how we should migrate from ModifiersUtils from v7 in v8? |
Beta Was this translation helpful? Give feedback.
-
Hi @thomasmattheussen, would you share some code samples? |
Beta Was this translation helpful? Give feedback.
@wannesdebacker if I understand correctly, you want to know the modifiers of the date entered in the input field (e.g. is the typed date already selected?). Am I correct? Since you decide the logic of this modifiers, you should be able to tell by yourself in the code – without he need of the DayPicker hooks:
https://codesandbox.io/s/react-daypicker-forked-hdwwrw?file=/src/App.tsx
DayPicker hooks are for custom components. If you want for some reason use these hooks, you need to place your input field in a custom component, such a Caption or a Footer. There the hooks are accessible (you can import the original component as well):
https://codesandbox.io/s/react-daypicker-forked-gdjnxx?file=…