Open fczuardi opened 6 years ago
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.
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
andonInvalid
.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 asoptions
for the https://stripe.com/docs/stripe-js/reference#stripe-elements call. This causes this console.warning messages related to the unexpected properties ofdisabled
andonInvalid
.