Closed MaruSuarez14 closed 1 year ago
The UNSAFE error is related to DayColumn and not related to not sending the event. There are other issues open for that. If you need clicking on the number to do something else, you can always pass a custom component.
Example from the doc: https://github.com/jquense/react-big-calendar/blob/c7cd908936fefc989b86ed48d5c6248f87733af5/stories/helpers/customComponents.js#L5
Maybe what you're looking for is also onDrillDown
?
Check that this is really a bug
Reproduction link
https://github.com/FrostAskar/Pawcients-Veterinary-Solutions.git
Bug description
I'm using this library for mi TFG project. The problem is that i am trying to put in a reactive variable the selected day on the calendary. For achieve this, i'm using the "onSelectSlot" event athat calls the handleSelectDay function, which will only be in charge of assigning the day received in the props as the value of the selectedDay variable. In short, this is the way I use the calendar: <Calendar localizer={localizer} events={events} startAccessor="start" endAccessor="end" selectable={true} onSelectEvent={handleEventSelect} onSelectSlot={handleDateSelect} onNavigate={ handleDateSelect } min={minTime} max={maxTime} onView={handleView} style={{ height: 600 }} />
And "handleDateSelect" is implemented as follows: const handleDateSelect = date => { setSelectedDate(date); }; The problem is the following: When I click on the "squares" of the calendar, which represent each day of the month, the function handleSelectDay is called correctly. However, when the specific number, that is, the button, is clicked, this function is not called and the selected day does not change. I have also tried using the onNavigate event, but the day is still not assigned properly. Also, when the day is selected using the button (and therefore the view changes to Day) the following error is displayed on the console:
"react-dom.development.js:86 Warning: Using UNSAFE_componentWillReceiveProps in strict mode is not recommended and may indicate bugs in your code. See https://reactjs.org/link/unsafe-component-lifecycles for details.
Please update the following components: DayColumn"
I can't update the DayColumn component because it is internal to the library.
So I've done a lot of research on how to fix this error, trying to update the versions or trying different options, and I can only think that it could be a bug in the library.
Expected Behavior
I expect that the day changes when clicking on the button that switches you to the Day view.
Actual Behavior
When I click on the button with the number of the month, the onSelectSlot event is not emitted, therefore the day does not change and an error is displayed in the console.
react-big-calendar version
1.6.9
React version
18.2.0
Platform/Target and Browser Versions
Windows 10
Validations
Would you like to open a PR for this bug?