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

PropType error: inputComponent should be also be an object #262

Closed
jonathan-telnyx opened this issue Jun 7, 2019 · 2 comments
Closed

PropType error: inputComponent should be also be an object #262

jonathan-telnyx opened this issue Jun 7, 2019 · 2 comments

Comments

@jonathan-telnyx
Copy link

Hi,

I created a custom input with a wrapper to do styling and wrapped it with React.forwardRef to get access to the ref and pass it down to the input inside the wrapper.

Everything is working fine, but I get an warning in the console:
Warning: Failed prop type: Invalid prop `inputComponent` of type `object` supplied to `PhoneNumberInput`, expected `function`. because React.forwardRef returns an object.

So I think that the prop types for the inputComponent should be:
inputComponent : PropTypes.oneOf([PropTypes.func.isRequired, PropTypes.object.isRequired])

I can send you a PR if you prefer.

@catamphetamine
Copy link
Owner

Hmm, so they're objects then...
Seems that PropTypes.elementType is a better choice.
facebook/prop-types#200

Released the new version [email protected].

@jonathan-telnyx
Copy link
Author

@catamphetamine thanks, worked perfectly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants