react-native-cached-image icon indicating copy to clipboard operation
react-native-cached-image copied to clipboard

CachedImage default margin

Open witalobenicio opened this issue 7 years ago • 5 comments

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?

witalobenicio avatar Nov 02 '17 13:11 witalobenicio

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.

captura de tela 2017-11-02 as 10 32 31

witalobenicio avatar Nov 02 '17 13:11 witalobenicio

It seems the problem is that if you pass only style={} it is applied to container and to image.

witalobenicio avatar Nov 02 '17 13:11 witalobenicio

Experiencing the same issue ! It drove me crazy for a little bit !

Blapi avatar Nov 17 '17 16:11 Blapi

How to resolve this issue?

xihairanfeng avatar Mar 18 '19 10:03 xihairanfeng

Well, I wrapped the CachedImage with a View and moved the margin properties to the View component

TopeMateo avatar Apr 30 '19 03:04 TopeMateo