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

[FlowCleanup] Split ImageProps into DeprecatedPropTypes #21411

Closed
wants to merge 5 commits into from
Closed

[FlowCleanup] Split ImageProps into DeprecatedPropTypes #21411

wants to merge 5 commits into from

Conversation

sopranolinist
Copy link

@sopranolinist sopranolinist commented Sep 29, 2018

Related to #21342

  • Split ImageProps.js: moved propType declarations to DeprecatedImageProps.js
  • Renamed ImageProps references to DeprecatedImageProps in Image.ios.js

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!

@facebook-github-bot
Copy link
Contributor

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 cla@fb.com. Thanks!

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 29, 2018
@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

Copy link
Contributor

@RSNara RSNara left a 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.

Libraries/DeprecatedPropTypes/DeprecatedImageProps.js Outdated Show resolved Hide resolved
/**
* See https://facebook.github.io/react-native/docs/image.html#style
*/
style: DeprecatedStyleSheetPropType(DeprecatedImageStylePropTypes),
Copy link
Contributor

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?

Copy link
Author

@sopranolinist sopranolinist Sep 30, 2018

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?

Copy link
Contributor

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.

Copy link
Author

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.

@hramos hramos changed the title Split ImageProps into DeprecatedPropTypes [FlowCleanup] Split ImageProps into DeprecatedPropTypes Oct 1, 2018
Copy link
Contributor

@RSNara RSNara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a 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.

@react-native-bot
Copy link
Collaborator

@JenLindsay merged commit 408207b into facebook:master.

@facebook facebook locked as resolved and limited conversation to collaborators Oct 2, 2018
@react-native-bot react-native-bot added the Merged This PR has been merged. label Oct 2, 2018
t-nanava pushed a commit to microsoft/react-native-macos that referenced this pull request Jun 17, 2019
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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants