catamphetamine / react-phone-number-input

React component for international phone number input

Home Page:http://catamphetamine.gitlab.io/react-phone-number-input/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The prop `metadata` is marked as required

justinhandley opened this issue · comments

I'm getting this error when running this in Remix / React. It doesn't seem to break anything, but I hate seeing big red errors in the console - what am I missing?

Warning: Failed prop type: The prop metadatais marked as required inForwardRef(PhoneInputWithCountry2), but its value is undefined. at PhoneInputWithCountry2 (http://localhost:4200/build/_sh

import PhoneInputWithCountry from 'react-phone-number-input/react-hook-form'
import { E164Number } from 'libphonenumber-js'

 <PhoneInputWithCountry
              name={field.key}
              control={control}
              defaultCountry={'US'}
              defaultValue={(field?.options?.defaultValue as E164Number) ?? ''}
              rules={{ required: true, validate: isPossiblePhoneNumber }}
              placeholder={field?.options?.placeholder ?? 'Phone number'}
            />

This should've been already fixed. See if you have the latest version installed.

OK, yes - thank you. I was on 3.3.0 - updating to 3.3.4 fixed the issue. Thanks for your time!