Quantcast
Channel: Active questions tagged listview - Stack Overflow
Viewing all articles
Browse latest Browse all 611

Migrate from ListView to FlatList in ReactNative

$
0
0

I have been working on upgrading an old project (rn v 0.59.0) to rn v 0.74.3. I am currently stuck on migrating from ListView to FlatList. Specifically this code.

const listDataSource = new ListView.DataSource({  getSectionData: SearchList.getSectionData,  getRowData: SearchList.getRowData,  rowHasChanged: (row1, row2) => {    if (row1 !== row2) {      return true    } else return !!(row1 && row2 && row1.matcher && row2.matcher && row1.matcher !== row1.matcher)  },  sectionHeaderHasChanged: (s1, s2) => s1 !== s2})

Is there an equivalent way to do this with FlatList? I am trying to maintain the current SearchList view if I can. I have tried using the 'deprecated-react-native-listview' package, but it's throwing a different error that I can't seem to resolve either.

ReactClassInterface: You are attempting to define `UNSAFE_componentWillMount` on your component more than once. This conflict may be due to a mixin.

Viewing all articles
Browse latest Browse all 611

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>