List is not updated/rerendered unless scrolled far away and back
See original GitHub issueI’m trying to display a checkbox alongside each row in the list. Upon clicking on the checkbox, I want it to -be selected/de-selected. I do this by updating the array element property. However, the row is not updated until I scroll far away and then scroll back. I also tried the extendedState
prop but that did not help too.
checkboxSelected(item) {
item.selected = !item.selected
}
<Checkbox checked={!!item.selected} onPress={this.checkboxSelected.bind(this, item)} />
Any help would be much appreciated. Thanks
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:12
Top Results From Across the Web
Avoid rerendering every component in list while updating only ...
When the messages state updates it's a new array, and so it must be rerendered. React's reconciliation needs to rerender the array and...
Read more >How to stop re-rendering lists in React? - Alex Sidorenko
Components always re-render. First, let's simplify our example by removing all props from the Item . We will still update the parent state...
Read more >Understanding how and when SwiftUI decides to redraw views
Another issue that I investigated is one where scrolling performance suffered greatly when just one or two items in a list were updated....
Read more >overscroll-behavior - CSS: Cascading Style Sheets | MDN
The overscroll-behavior CSS property sets what a browser does when reaching the boundary of a scrolling area.
Read more >Usage | FlashList
Switch from FlatList to FlashList and render the list once. ... If this isn't provided initialScrollIndex might not scroll to the provided ...
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 FreeTop 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
Top GitHub Comments
@sksin28 The problem is, you’re mutating the object directly, instead of making a new object. That means that the reference is the same
And when the
rowHasChanges
runs, it won’t see that there are any changes.Instead, you should be making a new object
So, in your code:
@rasanu This is how I got it going in my case.