-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Add definition for React.forwardRef() #6510
Conversation
Hi! Started introducing Flow into my React project last week. As we focus on accessibility a lot, there is a lot of focus management and therefore usage of Refs. So we immediately bumped into this one with I understand how these projects go and therefore understand that everyone is busy, but could I ask if there is any idea when Flow will support the new 16.3 features fully? Is there also some clear documentation/examples somewhere showing how to use Flow with Thank you so much for building tools like this and maintaining it. |
Hey @AlmeroSteyn,
|
@motiz88, thanks for the reponse. Had to backtrack on using Flow as we use Thanks for the invite to participate with PR's, however other areas of focus are sapping my time currently. Not that it would help though, the problem is that I cannot get these types working at all LOL. Much less document them. |
@mrkev Any chance you could give this a look? I'm not overjoyed about the #6103 (comment) situation but I think it's the best we can get out of the current mechanics of Flow, and the drawbacks are outweighed by the benefits of providing some form of support for this React feature, 5 months now since its release. |
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.
motiz88 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
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.
I'm not at all familiar with the Flow codebase– so someone like @samwgoldman or @avikchaudhuri should have the final say here, but I think the forwardRef
type looks right to me! 👍
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.
motiz88 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Reviewed By: gabelevi, pakoito Differential Revision: D13217025 fbshipit-source-id: af6f93077fb5b457b2e2fc516f583dc0fb4df776
This was reviewed internally a while back, but we never updated this PR. Sorry about that. The proposed types here are not quite correct and lead to missed errors when the Supporting forwardRef properly requires some deeper changes to Flow's React support, which @jbrown215 is working on. |
Closes #6103. There is some context re: soundness in #6103 (comment).
The type of therender
argument here diverges very slightly from that in Reactmaster
at the moment, but see facebook/react#13100 for the reason why.UPDATE: With facebook/react#13100 now merged, this is aligned with the React source code's own definition of
forwardRef
.