Open witalobenicio opened 6 years ago
Another exemple:
<CachedImage
resizeMethod={'scale'}
style={[styles.imageItem, {backgroundColor: '#000'}]}
source={{uri: this.props.source}}
/>
imageItem: {
margin: 6,
alignItems: 'center',
borderRadius: 10,
height: 50,
width: 50,
},
Produces this.
It seems the problem is that if you pass only style={} it is applied to container and to image.
Experiencing the same issue ! It drove me crazy for a little bit !
How to resolve this issue?
Well, I wrapped the CachedImage with a View and moved the margin properties to the View component
When I pass a margin in my style, e.g.:
"margin: 5"
, It's like the CachedImage already has a margin and my image is placed wrong. I have to pass"margin: 2.5"
to work properly. How to avoid that?