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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: form to accept react component #1511
Conversation
packages/core/src/components/Form.js
Outdated
@@ -428,7 +428,7 @@ if (process.env.NODE_ENV !== "production") { | |||
onSubmit: PropTypes.func, | |||
id: PropTypes.string, | |||
className: PropTypes.string, | |||
tagName: PropTypes.string, | |||
tagName: PropTypes.oneOfType([PropTypes.string, PropTypes.elementType]), |
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 think I should be able to make this just PropTypes.elementType
馃
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.
Hmm, does PropTypes.elementType include strings?
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.
Yeah, it's a ReactComponentLike
:
export type ReactComponentLike =
| string
| ((props: any, context?: any) => any)
| (new (props: any, context?: any) => any);
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.
Looks good, thanks. I wonder if tagName
is now a bit misleading though since it really refers to a component name...
@epicfaace I agree, but if we wanted to change it, it would be a And since |
Yeah, true. I'll go ahead and merge this for now, though. Do you have any suggestions for what a better prop name might be? |
We could go for the |
Reasons for making this change
In development, we weren't able to pass a react component into the
tagName
prop. This is valid in React but was unable to test in development due toPropTypes
.It also looked like some packages weren't properly locked, so I've updated those.
Side Note: We may want to look into migrating to
yarn
. Just a 馃挱Checklist