1.0.24 • Published 4 years ago
react-native-gc-list-view v1.0.24
react-native-gc-list-view
Getting started
$ npm install react-native-gc-list-view --save
Mostly automatic installation
$ react-native link react-native-gc-list-view
Usage
import GCListView from 'react-native-gc-list-view';
// TODO: What to do with the module?
<GCListView
renderItem={this.renderItem}
data={this.state.data}
itemLayouts={this.state.itemLayouts}>
</GCListView>
renderItem = (item: any, index: number) => {
return (
<TouchableOpacity onPress={this.onPress}
style={{ flex: 1 }}>
<View style={styles.itemStyle}>
<Text style={styles.itemTitle}>{item.title}</Text>
<Image
style={{ width: 45, height: 45 }}
source={{ uri: item.url }}></Image>
</View>
</TouchableOpacity>);
}
The component need pass itemLayouts for each item. The code mock up to create item layouts
calcItemLayout(data: any[]): number[] {
data = data || [];
const itemLayouts: number[] = [];
let lastOffset = 0;
let height = 50;
for (let i = 0; i < data.length; i++) {
lastOffset += height;
itemLayouts.push(lastOffset);
}
return itemLayouts;
}
1.0.24
4 years ago
1.0.23
4 years ago
1.0.22
4 years ago
1.0.18
4 years ago
1.0.21
4 years ago
1.0.20
4 years ago
1.0.17
4 years ago
1.0.16
4 years ago
1.0.15
4 years ago
1.0.14
4 years ago
1.0.13
4 years ago
1.0.12
4 years ago
1.0.11
4 years ago
1.0.10
4 years ago
1.0.9
4 years ago
1.0.8
4 years ago
1.0.7
4 years ago
1.0.6
4 years ago
1.0.5
4 years ago
1.0.4
4 years ago
1.0.3
4 years ago
1.0.2
4 years ago
1.0.1
4 years ago
1.0.0
4 years ago