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

input hoc causes warnings when appllied to Stripe's CardElement component #186

Open
fczuardi opened this issue Dec 26, 2017 · 1 comment

Comments

@fczuardi
Copy link
Contributor

fczuardi commented Dec 26, 2017

The current input hoc adds some properties to the wrapped component regardless of if this properties where passed or not. Examples of such properties are disabled and onInvalid.

Other handlers are always passed as well, regardless of if they were provided or not, like onChange, onFocus and onBlur. They all have default values.

This is not a problem for input components, as they share those attributes, but for other React components that don't expect those properties, this can be a problem.

For example, the CardElement from https://github.com/stripe/react-stripe-elements does accept and expect onBlur, onFocus, onChange, className and some others, but it treats all remaining properties as options for the https://stripe.com/docs/stripe-js/reference#stripe-elements call. This causes this console.warning messages related to the unexpected properties of disabled and onInvalid.

screen shot 2017-12-26 at 5 45 47 pm

Unrecognized element.update() parameter: disabled is not a recognized parameter. This may cause issues with your integration in the future.

Unrecognized element.update() parameter: onInvalid is not a recognized parameter. This may cause issues with your integration in the future.
@fczuardi
Copy link
Contributor Author

Maybe we should also file feature requests to stripe, for them to support onInvalid event handlers and to support a disabled option on their API. But from our side, we should maybe only forward to the underlining component, attributes that were passed in the first place, and not always assume that the underlining component is a form input and add the disabled flag and the event handler properties.

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

No branches or pull requests

1 participant