Agenda Component: It doesn't re-render after updating data
See original GitHub issueDescription
Agenda does not re-render calendar events after updating one of those events. In our application, we want to remove an event whenever it is clicked. After clicking on an event, the complete agenda disappears (except header).
Expected Behavior
I clicked on an event and called an API to remove that event from the dates lis. It should remove that event and re-render other events.
Observed Behavior
The complete Agenda (except header disappeared.
Environment
npm ls react-native-calendars
: react-native-calendars@1.1264.0npm ls react-native
: react-native@0.63.2
Also specify:
Screenshots
Before booking an event:
After booking an event:
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:15
Top Results From Across the Web
State update doesn't re-render component in ReactJS
The useEffect in PaginationButtons is using an empty dependency so it doesn't update when the data prop updates.
Read more >How and when to force a React component to re-render
Generally, forcing a React component re-render isn't best practice, even when React fails to update the components automatically.
Read more >Learn how to force react components to rerender without ...
A complete guide on component re-rendering. Here you will learn how to force react components to rerender without calling the set state.
Read more >State and Lifecycle - React
setState() to schedule updates to the component local state: ... For example, this will not re-render a component: ... The Data Flows Down....
Read more >How to force a React component to re-render - Rootstack
A React component automatically re-renders whenever there is a change in state or props, it only takes a simple state update from anywhere...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Also, inside of
node_modules/react-native-calendars/src/agenda/reservation-list/reservation.js
there is ashouldComponentUpdate
method. Removing it or commenting it out, lets you update the agenda on updates to the view.I recommend this one from the workaround above. This solution lets you persist the layout position on the list without restarting the list and taking you all the way to the top.
You can apply the change and then patch the package until is fixed I guess. Here’s a link on how to patch a package: https://www.youtube.com/watch?v=2AVs-Yh1bS8&t=108s
Hope it helps future readers 😃
I have the same trouble, the Calendar does not re-render on data change.