@luxdependency/echoit
Version:
Brick List with regreshing Function
35 lines (29 loc) • 926 B
JavaScript
import React from 'react';
import { View, StyleSheet, Dimensions, ScrollView, RefreshControl } from 'react-native';
var { width } = Dimensions.get('window');
export default (props) => <ScrollView
refreshControl={
<RefreshControl
refreshing={props.refreshControl.props.refreshing}
onRefresh={props.refreshControl.props.onRefresh}
/>
}
>
<View style={styles.container}>
{props.data.map((prop) => {
return <View key={prop.id} style={{
width: (100 / props.columns) * prop.span + '%',
height: props.rowHeight === undefined ? width / props.columns : props.rowHeight
}} >
{props.renderItem(prop)}
</View>
})}
</View>
</ScrollView>
const styles = StyleSheet.create({
container: {
width: '100%',
flexDirection: 'row',
flexWrap: 'wrap'
},
});