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

Metadata marked as required but gets undefined

kirkegaard opened this issue Β· comments

When using import PhoneInputWithCountry from "react-phone-number-input/react-hook-form"; im getting a warning:

Screenshot 2023-08-07 at 14 24 29
$ yarn why react-hook-form
yarn why v1.22.19
[1/4] πŸ€”  Why do we have the module "react-hook-form"...?
[2/4] 🚚  Initialising dependency graph...
[3/4] πŸ”  Finding dependency...
[4/4] 🚑  Calculating file sizes...
=> Found "react-hook-form@7.45.4"
info Has been hoisted to "react-hook-form"
info This module exists because it's specified in "dependencies".
info Disk size without dependencies: "1.91MB"
info Disk size with unique dependencies: "1.91MB"
info Disk size with transitive dependencies: "1.91MB"
info Number of shared dependencies: 0
✨  Done in 0.17s.

$ yarn why react-phone-number-input
yarn why v1.22.19
[1/4] πŸ€”  Why do we have the module "react-phone-number-input"...?
[2/4] 🚚  Initialising dependency graph...
[3/4] πŸ”  Finding dependency...
[4/4] 🚑  Calculating file sizes...
=> Found "react-phone-number-input@3.3.1"
info Has been hoisted to "react-phone-number-input"
info This module exists because it's specified in "dependencies".
info Disk size without dependencies: "9.73MB"
info Disk size with unique dependencies: "43.2MB"
info Disk size with transitive dependencies: "43.32MB"
info Number of shared dependencies: 9
✨  Done in 0.35s.

$ yarn why libphonenumber-js
yarn why v1.22.19
[1/4] πŸ€”  Why do we have the module "libphonenumber-js"...?
[2/4] 🚚  Initialising dependency graph...
[3/4] πŸ”  Finding dependency...
[4/4] 🚑  Calculating file sizes...
=> Found "libphonenumber-js@1.10.39"
info Reasons this module exists
   - "react-phone-number-input" depends on it
   - Hoisted from "react-phone-number-input#libphonenumber-js"
info Disk size without dependencies: "9.84MB"
info Disk size with unique dependencies: "9.84MB"
info Disk size with transitive dependencies: "9.84MB"
info Number of shared dependencies: 0
✨  Done in 0.18s.

The same problem.
Temporarily fixed this by importing metadata and explicitly assigning it to PhoneInput.

import metadata from 'libphonenumber-js/min/metadata'
...
<PhoneInputWithCountry
	international
	metadata={metadata}

Experiencing the same as well.

Turns out that the previous refactoring that removed .defaultProps has left .isRequired on those props and those .isRequired statements should've been removed too.

Published react-phone-number-input@3.3.2.