-
Notifications
You must be signed in to change notification settings - Fork 24.5k
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
Added support for Image corner radii in Android #5197
Conversation
By analyzing the blame information on this pull request, we identified @mkonicek, @kmagiera and @brentvatne to be potential reviewers. |
I'm not convinced we should add and maintain this code in the core given it's sort of an edge-case feature, and Android only. Would you be up for releasing a separate image module that supports this for people who need this feature? |
@mkonicek - as I mentioned in Discord, and I think you agree with me now -- this exists on iOS and web and this is a good step forward for parity. |
Hi, thanks for considering this pull request, please let me know if I need to update to resolve any conflicts since I originally submitted it - also if necessary I can look to move this into separate image module as suggested. |
Would be great if you could squash and rebase your changes in top of master - so that we can see if the tests are passing |
@mattds updated the pull request. |
1 similar comment
@mattds updated the pull request. |
borderTopLeftRadius: ReactPropTypes.number, | ||
borderTopRightRadius: ReactPropTypes.number, | ||
borderBottomLeftRadius: ReactPropTypes.number, | ||
borderBottomRightRadius: ReactPropTypes.number, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@brentvatne how is this being used on iOS? If it does exists there, why do we need to add "android-specific" code here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry @kmagiera, it seems that I was mistaken here: these properties are not currently supported directly on the Image
component on iOS. The only way to re-create this effect on iOS is by adding a corner radius to a wrapper View, but this does not work on Android.
<View style={styles.test}>
<Image
style={styles.image}
source={{uri: 'https://www.petfinder.com/wp-content/uploads/2012/11/140272627-grooming-needs-senior-cat-632x475.jpg'}}
/>
</View>
test: {
borderTopLeftRadius: 20,
overflow: 'hidden',
},
Results in:
On the web, and on React Native Android with this PR, assigning the border property specifically to images works:
So even though this isn't actually the current behaviour on iOS I think it is still desirable for us to pull this in, and we can bring iOS to parity eventually. cc @vjeux
Just a few minor comments inline and it's good to go. Thanks @mattds for your patience :) |
It's a pleasure, will make the changes mentioned now. |
@mattds updated the pull request. |
Looks good, just waiting for @brentvatne response on that inline comment |
Thanks, this is going to be very useful :) borderRadius was kind of limited as is. |
@mkonicek would you mind taking a look at this pull request? It's been a while since the last commit was reviewed. |
@brentvatne replied: #5197 (comment) Will let @kmagiera review this one. |
@facebook-github-bot shipit |
Thanks for importing. If you are an FB employee go to Phabricator to review. |
Summary:Split out from PR facebook#4252 - kmagiera I've made the changes to how the radii arrays are allocated, is the approach I've taken correct? also it looks like ImageStylePropTypes are needed so I left them in for the moment. I suppose this pull request will only be valid if iOS supports image corner radii, but at least it's here if/when needed. Attached an image of how it handles the existing case:  Closes facebook#5197 Differential Revision: D3138725 Pulled By: mkonicek fb-gh-sync-id: df772fd07fe85386ae4c681f9e79a19d2316d38b fbshipit-source-id: df772fd07fe85386ae4c681f9e79a19d2316d38b
Summary:Split out from PR facebook#4252 - kmagiera I've made the changes to how the radii arrays are allocated, is the approach I've taken correct? also it looks like ImageStylePropTypes are needed so I left them in for the moment. I suppose this pull request will only be valid if iOS supports image corner radii, but at least it's here if/when needed. Attached an image of how it handles the existing case:  Closes facebook#5197 Differential Revision: D3138725 Pulled By: mkonicek fb-gh-sync-id: df772fd07fe85386ae4c681f9e79a19d2316d38b fbshipit-source-id: df772fd07fe85386ae4c681f9e79a19d2316d38b
Summary:Split out from PR facebook#4252 - kmagiera I've made the changes to how the radii arrays are allocated, is the approach I've taken correct? also it looks like ImageStylePropTypes are needed so I left them in for the moment. I suppose this pull request will only be valid if iOS supports image corner radii, but at least it's here if/when needed. Attached an image of how it handles the existing case:  Closes facebook#5197 Differential Revision: D3138725 Pulled By: mkonicek fb-gh-sync-id: df772fd07fe85386ae4c681f9e79a19d2316d38b fbshipit-source-id: df772fd07fe85386ae4c681f9e79a19d2316d38b
Split out from PR #4252 - @kmagiera I've made the changes to how the radii arrays are allocated, is the approach I've taken correct? also it looks like ImageStylePropTypes are needed so I left them in for the moment. I suppose this pull request will only be valid if iOS supports image corner radii, but at least it's here if/when needed. Attached an image of how it handles the existing case:
