You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is however helpful to keep access to native event. For example, when wrapping an existing Input component already having an onChange callback, which accepts a native event, like Chakra UI:
import{InputPropsasChakraInputProps}from'@chakra-ui/react'exportconstTelInput=forwardRef<HTMLInputElement,ChakraInputProps>(functionTelInput({
defaultValue,onChange: userOnChange,
...inputProps},userRef,){constphoneInput=usePhoneInput({value: defaultValue?.toString(),onChange: (data)=>{userOnChange?.(data.phone)// TS2345: Argument of type string is not assignable to parameter of type ChangeEvent<HTMLInputElement>},})// ...})
It would be great to extend data callback argument with an event field, which will have event propagated from handlePhoneValueChange.
Currently,
usePhoneInput
takesonChange
callback that accepts parsed params (data: { phone: string; inputValue: string; country: ParsedCountry })
).It is however helpful to keep access to native event. For example, when wrapping an existing Input component already having an
onChange
callback, which accepts a native event, like Chakra UI:It would be great to extend
data
callback argument with anevent
field, which will have event propagated fromhandlePhoneValueChange
.Meanwhile, this works for selected use cases:
The text was updated successfully, but these errors were encountered: