I am working on a react-native application where I am using react-native-draggable-flatlist for one of the list and unfortunately I have to use shouldComponentUpdate in the component for data manipulation from other list item on another component, but after adding the shouldComponentUpdate, my drag/drop is not not working, I can able to drag and drop but it immediately resets the whole list to original positioning set.
Please help me with some suggestions to make the drag/drop work along with shouldComponentUpdate as I don't want to break the existing functionality
Code
<DraggableFlatList
scrollPercent={5}
data={testData}
renderItem={this.renderItem}
keyExtractor={item => `item-${testkey}`}
onMoveEnd={({ data }) => {
this.setState({ data });
}}
/>
public shouldComponentUpdate(nextProps, nextState) {
if (nextProps.data.length !== nextState.data.length) {
this.setState({
data: nextProps.data
})
}
return true
}