Skip to content

[flow-strict] Flow strict TextProps - #22122

Closed
exced wants to merge 14 commits into
react:masterfrom
exced:flowTextProps
Closed

exced wants to merge 14 commits into
react:masterfrom
exced:flowTextProps

Conversation

@exced

@exced exced commented Nov 4, 2018

Copy link
Copy Markdown
Contributor

Related to #22100

Turn on Flow strict mode for TextProps.
I used ResponseHandlers type definition defined in Text.js.

I wanted to move ResponseHandlers type to TextProps and reuse it inside the file.
I know I could use $Shape<> to maybe keys but how do I elegantly maybe every values ?
Unless having a straightforward solution, I found it clearer to copy paste these types.

Test Plan:

  • All flow tests succeed.

Release Notes:

[GENERAL] [ENHANCEMENT] [TextProps.js] - Flow strict mode

@exced
exced requested a review from shergin as a code owner November 4, 2018 23:05
@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 Nov 4, 2018
@turnrye

turnrye commented Nov 5, 2018

Copy link
Copy Markdown
Contributor

Hi @exced! Thanks for the help! I plan to combine those entries in the changelog to a single entry, so the changelog section in this PR is n/a. I'll make sure that once this PR lands, you're attributed for your contribution.

@RSNara RSNara changed the title Flow strict TextProps [flow-strict] Flow strict TextProps Nov 5, 2018
@elicwhite

Copy link
Copy Markdown
Contributor

cc @empyrical, you two have similar types here for the responders between ViewProps and TextProps. Can you work together to figure out how these types should be consistent / share the same types?

@empyrical

Copy link
Copy Markdown
Contributor

Maybe PanResponder can export a ResponderProps type that both View and Text can use the ...spread operator to make use of them?

@exced

exced commented Nov 5, 2018

Copy link
Copy Markdown
Contributor Author

@empyrical Sounds good, do you want me to add it into this PR ?

@empyrical

empyrical commented Nov 5, 2018 •

Copy link
Copy Markdown
Contributor

Actually I'm not sure if this can be done - it looks like Text and View don't all use the same responder props.

But for the type of event on your callbacks, you should import and use GestureState from PanResponder. I realize I improperly typed the event type in my PR and I will be updating them too. Then I think we are good on the responder types!

@empyrical

Copy link
Copy Markdown
Contributor

Sorry ignore that suggestion, I had that wrong because I was looking at something else 🤦‍♂️ Import PressEvent from CoreEventTypes and use that instead of SyntheticEvent<>

@exced

exced commented Nov 5, 2018

Copy link
Copy Markdown
Contributor Author

No worries 😊

@exced

exced commented Nov 6, 2018

Copy link
Copy Markdown
Contributor Author

@empyrical I replaced SyntheticEvent<> by PressEvent

@RSNara RSNara left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Awesome! 😁

@facebook-github-bot facebook-github-bot left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Collaborator

@exced merged commit 7927497 into facebook:master.

@react react locked as resolved and limited conversation to collaborators Nov 21, 2018
@react-native-bot react-native-bot added the Merged This PR has been merged. label Nov 21, 2018
t-nanava pushed a commit to microsoft/react-native-macos that referenced this pull request Jun 17, 2019
Summary:
Related to react#22100

Turn on Flow strict mode for TextProps.
I used ResponseHandlers type definition defined in Text.js.

I wanted to move ResponseHandlers type to TextProps and reuse it inside the file.
I know I could use $Shape<> to maybe keys but how do I elegantly maybe every values ?
Unless having a straightforward solution, I found it clearer to copy paste these types.

- All flow tests succeed.

[GENERAL] [ENHANCEMENT] [TextProps.js] - Flow strict mode
Pull Request resolved: react#22122

Reviewed By: TheSavior

Differential Revision: D13055759

Pulled By: RSNara

fbshipit-source-id: 230b43c7c94d7f82f5727ad11541b0cb98bc5e3a
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. Component: Text Flow Merged This PR has been merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants