...
|
...
|
@@ -3,6 +3,7 @@ |
|
|
import React from 'react';
|
|
|
import ReactNative from 'react-native';
|
|
|
import Immutable, {Map} from 'immutable';
|
|
|
import YH_Image from '../../../common/components/YH_Image';
|
|
|
|
|
|
const {
|
|
|
AppRegistry,
|
...
|
...
|
@@ -38,14 +39,16 @@ export default class AppIconList extends React.Component { |
|
|
title = title&&title.length?title:'';
|
|
|
let cellStyle = styles.cell;
|
|
|
let imgStyle = styles.cellImg;
|
|
|
let titleStyle = styles.cellTitle;
|
|
|
if (this.props.number == '4') {
|
|
|
cellStyle = styles.cell4;
|
|
|
imgStyle = styles.cellImg4;
|
|
|
titleStyle = styles.cellTitle4;
|
|
|
}
|
|
|
return (
|
|
|
<TouchableOpacity style={cellStyle} onPress={()=>{this.props.onPressAppIconItem && this.props.onPressAppIconItem(url, rowID)}}>
|
|
|
<Image style={imgStyle} source={{uri:src}} resizeMode={'contain'}/>
|
|
|
<Text style={styles.cellTitle}>{title}</Text>
|
|
|
<TouchableOpacity activeOpacity={1} style={cellStyle} onPress={()=>{this.props.onPressAppIconItem && this.props.onPressAppIconItem(url, rowID)}}>
|
|
|
<YH_Image style={imgStyle} url={src} />
|
|
|
<Text style={titleStyle}>{title}</Text>
|
|
|
</TouchableOpacity>
|
|
|
);
|
|
|
}
|
...
|
...
|
@@ -55,19 +58,20 @@ export default class AppIconList extends React.Component { |
|
|
if (!data.length) {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
let count = parseInt(this.props.number);
|
|
|
let tail = (data.length%count != 0) ? 1 : 0;
|
|
|
let tail = (data.length % count != 0) ? 1 : 0;
|
|
|
let lineNumber = data.length/count + tail;
|
|
|
|
|
|
let padding = count == 4 ? padding4 : padding5;
|
|
|
let containerHeight = (count == 4 ? 84 : 75) * lineNumber + padding * (lineNumber - 1) + 12*width/320 + 19;
|
|
|
let containerHeight = (count == 4 ? 84 : 75) * lineNumber + padding * (lineNumber - 1) + 12;
|
|
|
|
|
|
let listContainerStyle = styles.brandContainer;
|
|
|
if (this.props.number == '4') {
|
|
|
listContainerStyle = styles.brandContainer4
|
|
|
}
|
|
|
return(
|
|
|
<Image style={[styles.container, {height: containerHeight}]} source={{uri:this.props.backImage}}>
|
|
|
<YH_Image style={[styles.container, {height: containerHeight}]} url={this.props.backImage}>
|
|
|
<ListView
|
|
|
contentContainerStyle={listContainerStyle}
|
|
|
enableEmptySections={true}
|
...
|
...
|
@@ -77,7 +81,7 @@ export default class AppIconList extends React.Component { |
|
|
scrollEnabled={false}
|
|
|
scrollsToTop={false}
|
|
|
/>
|
|
|
</Image>
|
|
|
</YH_Image>
|
|
|
);
|
|
|
return null;
|
|
|
}
|
...
|
...
|
@@ -90,12 +94,10 @@ let padding4 = (width - 51*4)/10; |
|
|
|
|
|
let styles = StyleSheet.create({
|
|
|
container: {
|
|
|
backgroundColor: '#f0f0f0',
|
|
|
backgroundColor: 'white',
|
|
|
},
|
|
|
brandContainer: {
|
|
|
backgroundColor: 'white',
|
|
|
borderColor: 'rgb(215, 215, 215)',
|
|
|
borderBottomWidth: 0.5,
|
|
|
flexDirection: 'row',
|
|
|
flexWrap: 'wrap',
|
|
|
width: width,
|
...
|
...
|
@@ -157,4 +159,15 @@ let styles = StyleSheet.create({ |
|
|
height: 51,
|
|
|
},
|
|
|
|
|
|
cellTitle4: {
|
|
|
backgroundColor: 'white',
|
|
|
fontSize: 11,
|
|
|
fontWeight: 'bold',
|
|
|
color: '#444444',
|
|
|
textAlign: 'center',
|
|
|
marginTop: 6*width/320,
|
|
|
marginLeft: 0,
|
|
|
marginRight: 0,
|
|
|
},
|
|
|
|
|
|
}); |
...
|
...
|
|