-
-
Notifications
You must be signed in to change notification settings - Fork 6.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
Support React forwardRef in pretty-format #6076
Conversation
Codecov Report
@@ Coverage Diff @@
## master #6076 +/- ##
==========================================
+ Coverage 64.13% 64.16% +0.02%
==========================================
Files 217 218 +1
Lines 8335 8344 +9
Branches 4 3 -1
==========================================
+ Hits 5346 5354 +8
- Misses 2988 2989 +1
Partials 1 1
Continue to review full report at Codecov.
|
cc @camspiers can you double-check? Thanks! |
depth: number, | ||
refs: Refs, | ||
printer: Printer, | ||
): string => printElementAsLeaf(getType(element), config); |
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.
can we make this part of the normal ReactElementPlugin
instead of creating a new one?
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.
Hah, I should read the OP more closely
Had to create a separate plugin since the forwardRef spec doesn't conform to normal React elements
Ok so I've looked into this a bit more and I don't think this is the right way to solve it. Think I have a better solution that I'll write up today so I'm going to close this PR in the mean time. |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
#6069 tried to add support for
React.forwardRef
formatting but it doesn't seem to work for me. I've got it working by adding a new pluginReactForwardRef
that handles forwardRef "elements". Had to create a separate plugin since the forwardRef spec doesn't conform to normal React elements: https://github.com/facebook/react/blob/920f30ef7732e87045ae6652c464b58267991b8f/packages/react/src/forwardRef.jsTest plan
Run tests and make sure they pass