Authored by 于良

字体增加平台判断 review by 草莓

... ... @@ -11,10 +11,12 @@ const {
Text,
ListView,
TouchableOpacity,
Platform,
} = ReactNative;
import {Map} from 'immutable';
import BrandProductListCell from '../../../../../common/components/ListCell/ProductListCell';
import DeviceInfo from 'react-native-device-info';
export default class HotProducts extends React.Component {
... ... @@ -50,10 +52,19 @@ export default class HotProducts extends React.Component {
}
renderHeader() {
let fontFamilyStyle = {};
if (Platform.OS === 'ios') {
let systemVersion = DeviceInfo.getSystemVersion();
systemVersion = parseFloat(systemVersion);
if (systemVersion >= 9.0) {
fontFamilyStyle = {fontFamily: 'PingFang SC'};
}
}
return(
<View style={styles.container}>
<View style={styles.title}>
<Text style={styles.text}>{this.props.resource.title}</Text>
<Text style={[styles.text, fontFamilyStyle]}>{this.props.resource.title}</Text>
<View style={styles.thumbnail}>
<TouchableOpacity activeOpacity={0.5} onPress={() => {
... ... @@ -121,7 +132,6 @@ const styles = StyleSheet.create({
text: {
textAlign: 'left',
fontSize: 16,
fontFamily: 'PingFang SC',
fontWeight: 'bold',
color: '#444',
},
... ...
... ... @@ -11,9 +11,11 @@ const {
Text,
ListView,
TouchableOpacity,
Platform,
} = ReactNative;
import {Map} from 'immutable';
import DeviceInfo from 'react-native-device-info';
export default class Recommend extends React.Component {
... ... @@ -50,10 +52,19 @@ export default class Recommend extends React.Component {
}
renderHeader() {
let fontFamilyStyle = {};
if (Platform.OS === 'ios') {
let systemVersion = DeviceInfo.getSystemVersion();
systemVersion = parseFloat(systemVersion);
if (systemVersion >= 9.0) {
fontFamilyStyle = {fontFamily: 'PingFang SC'};
}
}
let data = this.props.resource;
return(
<View style={styles.title}>
<Text style={styles.text}>{data.get('title')}</Text>
<Text style={[styles.text, fontFamilyStyle]}>{data.get('title')}</Text>
</View>
);
}
... ... @@ -130,7 +141,6 @@ const styles = StyleSheet.create({
text: {
textAlign: 'center',
fontSize: 16,
fontFamily: 'PingFang SC',
fontWeight: 'bold',
color: '#444',
},
... ...
This diff could not be displayed because it is too large.