Skip to content

Commit 7ec371d

Browse files
ArnonZethanshar
authored andcommitted
Image - ImageStyle prop (#254)
* Added imageStyle prop * Added PropTypes to imageStyle prop * ... * fixed typos
1 parent d1a153e commit 7ec371d

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/components/avatar/index.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ export default class Avatar extends BaseComponent {
4444
* Image props object
4545
*/
4646
imageProps: PropTypes.object,
47+
/**
48+
* Image style object used to pass additional style props
49+
* by components which render image
50+
*/
51+
imageStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.array, PropTypes.number]),
4752
/**
4853
* Listener-callback for when an image's (uri) loading
4954
* starts (equiv. to Image.onLoadStart()).
@@ -160,12 +165,12 @@ export default class Avatar extends BaseComponent {
160165
}
161166

162167
renderImage() {
163-
const {imageSource, onImageLoadStart, onImageLoadEnd, onImageLoadError, testID, imageProps} = this.props;
168+
const {imageSource, onImageLoadStart, onImageLoadEnd, onImageLoadError, testID, imageProps, imageStyle} = this.props;
164169
const hasImage = !_.isUndefined(imageSource);
165170
if (hasImage) {
166171
return (
167172
<Image
168-
style={this.styles.image}
173+
style={[this.styles.image, imageStyle]}
169174
source={imageSource}
170175
onLoadStart={onImageLoadStart}
171176
onLoadEnd={onImageLoadEnd}

src/components/image/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Image extends BaseComponent {
2020
*/
2121
sourceTransformer: PropTypes.func,
2222
/**
23-
* if provided image source we be drriven from asset name
23+
* if provided image source will be driven from asset name
2424
*/
2525
assetName: PropTypes.string,
2626
/**

0 commit comments

Comments
 (0)