Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Border Width is duplicated on image #100

Closed
DerMth opened this issue Oct 20, 2017 · 5 comments
Closed

Border Width is duplicated on image #100

DerMth opened this issue Oct 20, 2017 · 5 comments

Comments

@DerMth
Copy link

DerMth commented Oct 20, 2017

Hi,

There is an issue when setting a borderWidth style on an image.
When I set a borderWidth, the border is "duplicated" on iOS (not tested on Android).
capture d ecran 2017-10-20 a 11 15 31

Here is my image style :

const RoundedImage = styled(CachedImage)`
    width: 100px;
    height: 100px;
    borderColor: green;
    borderWidth: 3px;
`;

The radius in the screenshot or the Styled Component in the code are not important, the result is the same without.

I used the initial React Native image before and had no issue.

@kfiroo
Copy link
Owner

kfiroo commented Oct 20, 2017

@DerMth Hey,
If you take a look at the code here you can see we are rendering a ImageBackground component with the styles provided to CachedImage.

Can you try rendering the ImageBackground component and see if the problem still exists?

@DerMth
Copy link
Author

DerMth commented Oct 23, 2017

@kfiroo Hi,
The border seems not "duplicated" with the ImageBackground, but the image is not anymore rounded.
capture d ecran 2017-10-23 a 13 52 12

@kfiroo
Copy link
Owner

kfiroo commented Oct 23, 2017

@DerMth note that ImageBackground uses imageStyle prop for styles

@bbdroid
Copy link

bbdroid commented Oct 29, 2017

@DerMth Since this library renders the ImageBackground with the styles provided to CachedImage, you can try this.

  avatarWrapper: {
    height: 100,
    width: 100,
    borderRadius: 50,
    borderWidth: 2,
    borderColor: 'red',
    justifyContent: 'center',
    alignItems: 'center',
    overflow: 'hidden',
  },
  avatar: {
    height: 100,
    width: 100,
  },
....
<View style={styles.avatarWrapper}>
   <CachedImage
      style={styles.avatar}
      source={avatarSource}
   />
</View>

@DerMth
Copy link
Author

DerMth commented Oct 30, 2017

@kfiroo @bdavid68 Thanks for your answers.
I first used the method of @bdavid68, but in order to have less code, I used the imageStyle property : imageStyle={{ borderRadius: xx }}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants