question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Agenda Component: It doesn't re-render after updating data

See original GitHub issue

Description

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.0
  • npm ls react-native: react-native@0.63.2

Also specify:

Screenshots

Before booking an event: ss1

After booking an event: ss2

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:15

github_iconTop GitHub Comments

5reactions
abiespinal04commented, Dec 16, 2021

Also, inside of node_modules/react-native-calendars/src/agenda/reservation-list/reservation.js there is a shouldComponentUpdate 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 😃

4reactions
AlexandreMouyencommented, Nov 5, 2021

I have the same trouble, the Calendar does not re-render on data change.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found