Closed priyankapyt closed 5 years ago
It's not clear what you mean at all
@catamphetamine Sorry if I was not clear enough. Actually in my current app I'm using libphonenumber-js/mobile. But for optimisation i want to remove the meta.mobile.json out of my bundle.
So i was trying script to create custom meta file and use it.
But it is not working as expected for parsePhoneNumberFromString function from mobile flavour of it.
Do let me know if you need more details.
But for optimisation i want to remove the meta.mobile.json out of my bundle.
The library requires some metadata to work with. Otherwise it won't work.
Yes, that meta data file i'm passing as a parameter exactly as it is mentioned in custom meta-data part of documentation.
It is working as expected for functions from min flavor of library, but not for functions from mobile flavor of it.
@catamphetamine do you know why customisation doesn't work for mobile flavor of library and only works for min flavor of library? Even in example it shows use case of min flavor of library.
It is working as expected for functions from min flavor of library not for functions from mobile flavor of it.
Don't use min
or mobile
in that case, use custom
.
Yes, I'm using custom flavor only. But in that if you use below function it gives true and in mobile flavor it gives false. (expectes result is false as 1234567890 is invalid no)
parsePhoneNumberFromString('+911234567890').isValid()
Here 1234567890 is wrong mobile number entered by user.
If the results aren't valid then perhaps the metadata isn't valid.
Post how you generate your metadata.
"libphonenumber-metadata": "libphonenumber-generate-metadata metadata.min.json"
I'm generating my json using above script and later I'm saving it in my app and accessing it from there.
There's no need to do that — it won't differ from the min
metadata.
correct, so in a nutshell -> I have just kept the meta files out of the bundle and using custom flavour by passing metaData as parameter.
But in that case below function gives true and when I use mobile flavour it gives false. (expected result is false as 1234567890 is invalid no)
parsePhoneNumberFromString('+911234567890').isValid()
**here 1234567890 is wrong mobile number entered by user.
Closing the issue, got it. I was not passing the correct meta data files. Thanks @catamphetamine for directing towards correct issue.
Unable to do customise mobile library like min functionality.
I want to remove mobile.meta.json from my code for that I tried custom format as mentioned in the documentation but after that parsePhoneNumberFromString of mobile lib is not working.