Showing
3 changed files
with
21 additions
and
8 deletions
@@ -11,6 +11,7 @@ import ReactNative, { | @@ -11,6 +11,7 @@ import ReactNative, { | ||
11 | StyleSheet, | 11 | StyleSheet, |
12 | Dimensions, | 12 | Dimensions, |
13 | TouchableOpacity, | 13 | TouchableOpacity, |
14 | + Platform, | ||
14 | } from 'react-native'; | 15 | } from 'react-native'; |
15 | import Immutable from 'immutable'; | 16 | import Immutable from 'immutable'; |
16 | 17 | ||
@@ -45,7 +46,7 @@ export default class HotBrandList extends Component{ | @@ -45,7 +46,7 @@ export default class HotBrandList extends Component{ | ||
45 | return null; | 46 | return null; |
46 | } | 47 | } |
47 | 48 | ||
48 | - let imageUrl = SlicedImage.getSlicedUrl(rowData.get("brand_ico"), 70, 29, 2); | 49 | + let imageUrl = SlicedImage.getSlicedUrl(rowData.get("brand_ico"), (70 - diff), 29, 2); |
49 | let brandName = rowData.get("brand_name"); | 50 | let brandName = rowData.get("brand_name"); |
50 | 51 | ||
51 | return ( | 52 | return ( |
@@ -81,6 +82,10 @@ export default class HotBrandList extends Component{ | @@ -81,6 +82,10 @@ export default class HotBrandList extends Component{ | ||
81 | 82 | ||
82 | let {width, height} = Dimensions.get('window'); | 83 | let {width, height} = Dimensions.get('window'); |
83 | const DEVICE_WIDTH_RATIO = width / 320; | 84 | const DEVICE_WIDTH_RATIO = width / 320; |
85 | +console.log("chenlin:" + "width:" + width + "height:" + height + "DEVICE_WIDTH_RATIO:" + DEVICE_WIDTH_RATIO); | ||
86 | +let diff = (Platform.OS === 'android' && width < 440) ? 1 : 0; | ||
87 | + | ||
88 | + | ||
84 | 89 | ||
85 | 90 | ||
86 | let styles = StyleSheet.create({ | 91 | let styles = StyleSheet.create({ |
@@ -128,24 +133,24 @@ let styles = StyleSheet.create({ | @@ -128,24 +133,24 @@ let styles = StyleSheet.create({ | ||
128 | }, | 133 | }, |
129 | 134 | ||
130 | rowContainer:{ | 135 | rowContainer:{ |
131 | - width: 70 * DEVICE_WIDTH_RATIO, | ||
132 | - height: 70 * DEVICE_WIDTH_RATIO, | 136 | + width: (70 - diff) * DEVICE_WIDTH_RATIO, |
137 | + height: (70 - diff) * DEVICE_WIDTH_RATIO , | ||
133 | }, | 138 | }, |
134 | 139 | ||
135 | rowImageContainer:{ | 140 | rowImageContainer:{ |
136 | - width: 70 * DEVICE_WIDTH_RATIO, | 141 | + width: (70 - diff) * DEVICE_WIDTH_RATIO, |
137 | height: 50 * DEVICE_WIDTH_RATIO, | 142 | height: 50 * DEVICE_WIDTH_RATIO, |
138 | justifyContent: 'center', | 143 | justifyContent: 'center', |
139 | alignItems: 'center', | 144 | alignItems: 'center', |
140 | }, | 145 | }, |
141 | 146 | ||
142 | rowThumbnail:{ | 147 | rowThumbnail:{ |
143 | - width: 70 * DEVICE_WIDTH_RATIO, | 148 | + width: (70 - diff) * DEVICE_WIDTH_RATIO, |
144 | height: 29 * DEVICE_WIDTH_RATIO, | 149 | height: 29 * DEVICE_WIDTH_RATIO, |
145 | }, | 150 | }, |
146 | 151 | ||
147 | rowText:{ | 152 | rowText:{ |
148 | - width: 70 * DEVICE_WIDTH_RATIO, | 153 | + width: (70 - diff) * DEVICE_WIDTH_RATIO, |
149 | height: 20 * DEVICE_WIDTH_RATIO, | 154 | height: 20 * DEVICE_WIDTH_RATIO, |
150 | fontSize: 10, | 155 | fontSize: 10, |
151 | color: '#B0B0B0', | 156 | color: '#B0B0B0', |
@@ -11,6 +11,7 @@ import ReactNative, { | @@ -11,6 +11,7 @@ import ReactNative, { | ||
11 | StyleSheet, | 11 | StyleSheet, |
12 | Dimensions, | 12 | Dimensions, |
13 | TouchableOpacity, | 13 | TouchableOpacity, |
14 | + Platform, | ||
14 | } from 'react-native'; | 15 | } from 'react-native'; |
15 | import Immutable from 'immutable'; | 16 | import Immutable from 'immutable'; |
16 | 17 | ||
@@ -99,7 +100,7 @@ export default class HotCategoryList extends Component{ | @@ -99,7 +100,7 @@ export default class HotCategoryList extends Component{ | ||
99 | 100 | ||
100 | let {width, height} = Dimensions.get('window'); | 101 | let {width, height} = Dimensions.get('window'); |
101 | const DEVICE_WIDTH_RATIO = width / 320; | 102 | const DEVICE_WIDTH_RATIO = width / 320; |
102 | - | 103 | +let diff = (Platform.OS === 'android' && width < 440) ? 1 : 0; |
103 | 104 | ||
104 | let styles = StyleSheet.create({ | 105 | let styles = StyleSheet.create({ |
105 | 106 | ||
@@ -159,7 +160,7 @@ let styles = StyleSheet.create({ | @@ -159,7 +160,7 @@ let styles = StyleSheet.create({ | ||
159 | }, | 160 | }, |
160 | 161 | ||
161 | rowContainer:{ | 162 | rowContainer:{ |
162 | - width: 70 * DEVICE_WIDTH_RATIO, | 163 | + width: (70 - diff) * DEVICE_WIDTH_RATIO, |
163 | height: 93 * DEVICE_WIDTH_RATIO, | 164 | height: 93 * DEVICE_WIDTH_RATIO, |
164 | paddingLeft: 5 * DEVICE_WIDTH_RATIO, | 165 | paddingLeft: 5 * DEVICE_WIDTH_RATIO, |
165 | paddingRight: 5 * DEVICE_WIDTH_RATIO, | 166 | paddingRight: 5 * DEVICE_WIDTH_RATIO, |
@@ -52,6 +52,10 @@ export default class NativeRequest { | @@ -52,6 +52,10 @@ export default class NativeRequest { | ||
52 | body, | 52 | body, |
53 | }; | 53 | }; |
54 | let response = await ReactNative.NativeModules.YH_NativeRequest.get(params); | 54 | let response = await ReactNative.NativeModules.YH_NativeRequest.get(params); |
55 | + if (Platform.OS === 'android') { | ||
56 | + response = JSON.parse(response); | ||
57 | + } | ||
58 | + | ||
55 | let data = await this._parseResponse(response); | 59 | let data = await this._parseResponse(response); |
56 | return data; | 60 | return data; |
57 | 61 | ||
@@ -93,6 +97,9 @@ export default class NativeRequest { | @@ -93,6 +97,9 @@ export default class NativeRequest { | ||
93 | body, | 97 | body, |
94 | }; | 98 | }; |
95 | let response = await ReactNative.NativeModules.YH_NativeRequest.post(params); | 99 | let response = await ReactNative.NativeModules.YH_NativeRequest.post(params); |
100 | + if (Platform.OS === 'android') { | ||
101 | + response = JSON.parse(response); | ||
102 | + } | ||
96 | let data = await this._parseResponse(response); | 103 | let data = await this._parseResponse(response); |
97 | return data; | 104 | return data; |
98 | 105 |
-
Please register or login to post a comment