-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
[FlowCleanup] Split ImageProps into DeprecatedPropTypes #21411
[FlowCleanup] Split ImageProps into DeprecatedPropTypes #21411
Conversation
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed. If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
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.
Thanks for this PR!
This looks mostly good, but there's two minor changes I'd like to have made.
/** | ||
* See https://facebook.github.io/react-native/docs/image.html#style | ||
*/ | ||
style: DeprecatedStyleSheetPropType(DeprecatedImageStylePropTypes), |
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.
In general, we should have a singular source of truth for the documentation, which should be the flow types. So, could you move these comments to the ImageProps
flow type?
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.
While moving comments over, I noticed a few discrepancies between Flow properties and propType properties. The following are declared as propTypes (in DeprecatedImageProps, soon to be renamed DeprecatedImagePropType) but not in Flow (in ImageProps):
- accessible: PropTypes.bool
- accessibilityLabel: PropTypes.node
- resizeMode: PropTypes.oneOf([
'cover',
'contain',
'stretch',
'repeat',
'center',
]) - testID: PropTypes.string
- onLayout: PropTypes.func
Are these not needed in the Flow definitions, or are they missing from the Flow definitions? If they're not needed, what should I do with their corresponding comments? Delete them?
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.
Oh, interesting. We should move these properties to the flow definitions.
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.
Turns out resizeMode was already there, I missed it my first go around. The other 4 weren't though, so I added them.
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.
Awesome!
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.
RSNara has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
@JenLindsay merged commit 408207b into |
Summary: Related to facebook#21342 - Split ImageProps.js: moved propType declarations to DeprecatedImageProps.js - Renamed ImageProps references to DeprecatedImageProps in Image.ios.js Pull Request resolved: facebook#21411 Reviewed By: TheSavior Differential Revision: D10146178 Pulled By: RSNara fbshipit-source-id: 4db15eaaa8822e834af347d1927991dff1c427cb
Related to #21342
Test Plan:
Ran the following scripts with no errors:
npm run prettier
npm run flow-check-ios
npm run flow-check-android
Release Notes:
[GENERAL] [ENHANCEMENT] [ImageProps.js] - rm prop-types
[GENERAL] [ENHANCEMENT] [DeprecatedImageProps.js] - created file & added prop-types
[GENERAL] [ENHANCEMENT] [Image.ios.js] - renamed ImageProps to DeprecatedImageProps
This is my first PR, please let me know if I've done anything incorrectly - thanks!