-
Notifications
You must be signed in to change notification settings - Fork 73
Pass the Day instance as parameter of the onPickDate callback #23
Comments
Found a solution myself : I've added a ref to the outer element of the Day component : Then I pass it to the onClick callback : I use it that way : and I can access to the position of the clicked day by calling Observation : The classes parameter becomes irrelevant because we can access to the classes using the dayElement parameter. |
@AlexGeb could you explain how did you add the ref to the outer element of the Day component. And can you show your example please? |
Honestly I'm not a big fan of passing a Day reference to the |
@SagiSan, you can set the ref props of any element to a function which takes a ref to the element as input : @GiovanniFrigo I totally agree with you, I did it because I needed to position a popup and it was the first idea that came up. Another idea is to add a props to the Calendar component, such as dayClickedPopup, which has to be set as a component, propagate this props down the tree and display it at a Day level, as soon as it is clicked or hovered. |
Hello, thanks for sharing this great calendar !
I would like to know if it was possible to pass the clicked Day instance as param of the onPickDate callback.
I need to show a popup above the clicked day and so I need a ref to the Day instance which was clicked for positioning.
Thanks a lot !
(I'm forking your project to see if I can implement something useful )
The text was updated successfully, but these errors were encountered: