I have a ListView that displays a list of chat sessions (similar to Whatsapp / Facebook Messenger) with the following rowHasChanged :
rowHasChanged: (r1, r2) => r1.id !== r2.id
I noticed that elements that are not being updated get re-rendered, even if I use shouldComponentUpdate .
After some traces, I found that since I sort the elements differently, before cloning the dataSource (a new message forces the elements to go to the top of the list), rowHasChanged compares different strings. It makes sense to do this.
But isnβt there a solution to support performing sorting? In WPF, we had a CollectionViewSource that got something to sort by in addition to this data due to the same problem (also supported filtering and others).
Does anyone know how to get rid of these redundant renders?
react-native
Moti azu
source share