Authored by 孙凯

修改 iOS 7.1.2 crash review by hongmo

... ... @@ -4,6 +4,8 @@ import React from 'react';
import ReactNative from 'react-native';
import {getSlicedUrl} from '../../utils/Utils';
import Immutable, {Map} from 'immutable';
import YH_Image from '../../../common/components/YH_Image';
import DeviceInfo from 'react-native-device-info';
const {
AppRegistry,
... ... @@ -15,6 +17,7 @@ const {
Dimensions,
TouchableOpacity,
PixelRatio,
Platform,
} = ReactNative;
export default class BannerReourceList extends React.Component {
... ... @@ -37,21 +40,35 @@ export default class BannerReourceList extends React.Component {
renderRow(rowData,sectionID,rowID,highlightRow) {
let newSrc = getSlicedUrl(rowData.src, 140, 100, 2);
let needYH_Image = false;
if (Platform.OS === 'ios') {
let systemVersion = DeviceInfo.getSystemVersion();
systemVersion = parseFloat(systemVersion);
if (systemVersion < 8.0) {
needYH_Image = true;
}
}
return (
<TouchableOpacity activeOpacity={0.5} onPress={() => {
this.props.onPressSlideItem && this.props.onPressSlideItem(rowData, rowID);
}}>
<View style={styles.thumbnailV}>
<Image
{needYH_Image?<YH_Image
url={newSrc}
style={styles.thumbnail}
/>:<Image
source={{uri: newSrc}}
style={styles.thumbnail}
resizeMode={'contain'}
></Image>
<View style={styles.textV}>
<Text style={styles.text} numberOfLines={1}>
{rowData.name}
</Text>
</View>
></Image>}
<View style={styles.textV}>
<Text style={styles.text} numberOfLines={1}>
{rowData.name}
</Text>
</View>
</View>
</TouchableOpacity>
);
... ...
... ... @@ -6,6 +6,9 @@ import Swiper from 'react-native-swiper';
import ImmutablePropTypes from 'react-immutable-proptypes';
import SlicedImage from '../../../common/components/SlicedImage';
import Immutable, {Map} from 'immutable';
import YH_Image from '../../../common/components/YH_Image';
import {getSlicedUrl} from '../../utils/Utils';
import DeviceInfo from 'react-native-device-info';
const {
View,
... ... @@ -68,7 +71,18 @@ export default class BrandSwiper extends React.Component {
return null;
}
let needYH_Image = false;
if (Platform.OS === 'ios') {
let systemVersion = DeviceInfo.getSystemVersion();
systemVersion = parseFloat(systemVersion);
if (systemVersion < 8.0) {
needYH_Image = true;
}
}
if (list.length == 1) {
let newSrc = getSlicedUrl(list[0].src, width, height);
return (
<View style={styles.container}>
... ... @@ -79,7 +93,10 @@ export default class BrandSwiper extends React.Component {
this.props.onPressSlideItem && this.props.onPressSlideItem(list[0].url, 0);
}}
>
<SlicedImage source={{uri: list[0].src}} style={{width, height}}/>
{needYH_Image ? <YH_Image
url={newSrc}
style={{width, height}}
/> : <SlicedImage source={{uri: list[0].src}} style={{width, height}}/>}
</TouchableOpacity>
</View>
);
... ... @@ -99,6 +116,8 @@ export default class BrandSwiper extends React.Component {
paginationStyle={{backgroundColor: 'rgba(0,0,0,0.2)',bottom: 10,height: 10,width: list.length * 12,borderRadius: 5,marginLeft: (width-list.length * 12)/2}}
>
{list.map((item, i) => {
let newSrc = getSlicedUrl(item.src, width, height-15, 2);
return (
<TouchableOpacity
key={i}
... ... @@ -107,7 +126,10 @@ export default class BrandSwiper extends React.Component {
this.props.onPressSlideItem && this.props.onPressSlideItem(item.url, i);
}}
>
<SlicedImage source={{uri: item.src}} style={{width, height:height-15}}/>
{needYH_Image?<YH_Image
url={newSrc}
style={{width, height:height-15}}
/>:<SlicedImage source={{uri: item.src}} style={{width, height:height-15}}/>}
</TouchableOpacity>
);
})}
... ...