catamphetamine / react-phone-number-input

React component for international phone number input
http://catamphetamine.gitlab.io/react-phone-number-input/
MIT License
915 stars 193 forks source link

The prop `metadata` is marked as required #430

Closed justinhandley closed 10 months ago

justinhandley commented 10 months ago

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 propmetadatais marked as required inForwardRef(PhoneInputWithCountry2), but its value isundefined. 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'}
            />
catamphetamine commented 10 months ago

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

justinhandley commented 10 months ago

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