From 0eebe623571701abc7ac7414f4c83ae188eee482 Mon Sep 17 00:00:00 2001 From: chenl <chenl> Date: Wed, 22 Mar 2017 10:49:51 +0800 Subject: [PATCH] 增加YH_Image的resizeMode属性。review by yuliang。 --- js/common/components/YH_Image.js | 3 +++ js/home/components/floor/NewProductFloor.js | 15 ++++++++++----- js/home/components/floor/SixLinesFloor.js | 3 ++- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/js/common/components/YH_Image.js b/js/common/components/YH_Image.js index 7169089..cc49caf 100644 --- a/js/common/components/YH_Image.js +++ b/js/common/components/YH_Image.js @@ -22,6 +22,9 @@ const YH_ImageView = ReactNative.requireNativeComponent('YH_ImageView', null); * ios写法: masksToBounds={true} style中设置borderRadius圆角值 * android写法: radius={{'topLeft':'20','topRight':'20','bottomRight':'20','bottomLeft':'20'}} * + * 图片伸缩属性 resizeMode enum('cover', 'contain', 'stretch', 'repeat', 'center') 同RN Image属性, + * 注意要添加style属性的值 resizeMode: 'stretch' + * * **/ export default class YH_Image extends Component { diff --git a/js/home/components/floor/NewProductFloor.js b/js/home/components/floor/NewProductFloor.js index dd441bc..78ae71d 100644 --- a/js/home/components/floor/NewProductFloor.js +++ b/js/home/components/floor/NewProductFloor.js @@ -49,27 +49,27 @@ export default class NewProductFloor extends Component{ <TouchableOpacity style={styles.leftBigImageContainer} activeOpacity={1} yh_exposureData={imglst.get(0).get('yh_exposureData')} onPress={() => this.props.onPressImageItem && this.props.onPressImageItem(imglst.get(0).get('url'), leftBigImageUrl, 0)}> - <YH_Image style={styles.leftBigImage} url={leftBigImageUrl}/> + <YH_Image style={styles.leftBigImage} resizeMode={'stretch'} url={leftBigImageUrl}/> </TouchableOpacity> <TouchableOpacity style={styles.rightSmallTopLeftImageContainer} activeOpacity={1} yh_exposureData={imglst.get(1).get('yh_exposureData')} onPress={() => this.props.onPressImageItem && this.props.onPressImageItem(imglst.get(1).get('url'), rightSmallTopLeftImageUrl, 1)}> - <YH_Image style={styles.rightSmallTopLeftImage} url={rightSmallTopLeftImageUrl}/> + <YH_Image style={styles.rightSmallTopLeftImage} resizeMode={'stretch'} url={rightSmallTopLeftImageUrl}/> </TouchableOpacity> <TouchableOpacity style={styles.rightSmallBottomLeftImageContainer} activeOpacity={1} yh_exposureData={imglst.get(2).get('yh_exposureData')} onPress={() => this.props.onPressImageItem && this.props.onPressImageItem(imglst.get(2).get('url'), rightSmallBottomLeftImageUrl, 2)}> - <YH_Image style={styles.rightSmallBottomLeftImage} url={rightSmallBottomLeftImageUrl}/> + <YH_Image style={styles.rightSmallBottomLeftImage} resizeMode={'stretch'} url={rightSmallBottomLeftImageUrl}/> </TouchableOpacity> <TouchableOpacity style={styles.rightSmallTopRightImageContainer} activeOpacity={1} yh_exposureData={imglst.get(3).get('yh_exposureData')} onPress={() => this.props.onPressImageItem && this.props.onPressImageItem(imglst.get(3).get('url'), rightSmallTopRightImageUrl, 3)}> - <YH_Image style={styles.rightSmallTopRightImage} url={rightSmallTopRightImageUrl}/> + <YH_Image style={styles.rightSmallTopRightImage} resizeMode={'stretch'} url={rightSmallTopRightImageUrl}/> </TouchableOpacity> <TouchableOpacity style={styles.rightSmallBottomRightImageContainer} activeOpacity={1} yh_exposureData={imglst.get(4).get('yh_exposureData')} onPress={() => this.props.onPressImageItem && this.props.onPressImageItem(imglst.get(4).get('url'), rightSmallBottomRightImageUrl ,4)}> - <YH_Image style={styles.rightSmallBottomRightImage} url={rightSmallBottomRightImageUrl}/> + <YH_Image style={styles.rightSmallBottomRightImage} resizeMode={'stretch'} url={rightSmallBottomRightImageUrl}/> </TouchableOpacity> </View> </View> @@ -112,6 +112,7 @@ let styles = StyleSheet.create({ leftBigImage: { width: leftBigImageWidth, height: leftBigImageHeight, + resizeMode: 'stretch', }, rightSmallTopLeftImageContainer: { @@ -125,6 +126,7 @@ let styles = StyleSheet.create({ rightSmallTopLeftImage: { width: rightSmallImageWidth, height: rightSmallImageHeight, + resizeMode: 'stretch', }, rightSmallBottomLeftImageContainer: { @@ -138,6 +140,7 @@ let styles = StyleSheet.create({ rightSmallBottomLeftImage: { width: rightSmallImageWidth, height: rightSmallImageHeight, + resizeMode: 'stretch', }, rightSmallTopRightImageContainer: { @@ -151,6 +154,7 @@ let styles = StyleSheet.create({ rightSmallTopRightImage: { width: rightSmallImageWidth, height: rightSmallImageHeight, + resizeMode: 'stretch', }, @@ -165,6 +169,7 @@ let styles = StyleSheet.create({ rightSmallBottomRightImage: { width: rightSmallImageWidth, height: rightSmallImageHeight, + resizeMode: 'stretch', }, diff --git a/js/home/components/floor/SixLinesFloor.js b/js/home/components/floor/SixLinesFloor.js index 93d1d97..4c1f7fb 100644 --- a/js/home/components/floor/SixLinesFloor.js +++ b/js/home/components/floor/SixLinesFloor.js @@ -39,7 +39,7 @@ export default class SixLinesFloor extends Component{ return( <TouchableOpacity activeOpacity={1} yh_exposureData={rowData.get('yh_exposureData')} onPress={() => this.props.onPressImageItem && this.props.onPressImageItem(rowData.get('url'), goodsImageUrl, rowID)}> - <YH_Image style={styles.goodsImage} url={goodsImageUrl} /> + <YH_Image style={styles.goodsImage} resizeMode={'stretch'} url={goodsImageUrl} /> </TouchableOpacity> ); @@ -89,6 +89,7 @@ let styles = StyleSheet.create({ goodsImage: { width: imageWidth, height: imageHeight, + resizeMode: 'stretch', }, -- libgit2 0.24.0