Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save cooperka/6442c3c7efc1d6b18cd72071e0f72b4e to your computer and use it in GitHub Desktop.
Save cooperka/6442c3c7efc1d6b18cd72071e0f72b4e to your computer and use it in GitHub Desktop.
Migrating from ImmutableListView to ImmutableVirtualizedList in React Native (similar to FlatList).
import { Text, View } from 'react-native';
-import { ImmutableListView } from 'react-native-immutable-list-view';
+import { ImmutableVirtualizedList } from 'react-native-immutable-list-view';
import style from './styles';
import listData from './listData';
class App extends Component {
- renderRow(rowData) {
- return <Text style={style.row}>{rowData}</Text>;
+ renderItem({ item, index }) {
+ return <Text style={style.row}>{item}</Text>;
}
render() {
return (
<View style={style.container}>
<Text style={style.welcome}>
Welcome to React Native!
</Text>
- <ImmutableListView
+ <ImmutableVirtualizedList
immutableData={listData}
- renderRow={this.renderRow}
+ renderItem={this.renderItem}
/>
</View>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment