Rxova
Skip to content

PhoneInput

const PhoneInput: ForwardRefExoticComponent<PhoneInputProps & RefAttributes<HTMLInputElement>>;

forwardRef rather than reading props.ref.

React 19 passes ref as an ordinary prop, so props.ref works there — but React 18 strips it before props are built, so the ref would silently never populate. We declare react >= 18 as a peer, so the version that needs forwardRef is the one that decides. The ref lands on the <input>, not the wrapper: setFocus() in React Hook Form and focus-first-error patterns both expect a focusable form control.

The @__PURE__ annotation is load-bearing: forwardRef(...) is a top-level call, and without it bundlers must assume side effects and cannot drop this component from a build that only imports usePhoneInput.