FaridSafi / react-native-google-places-autocomplete

Customizable Google Places autocomplete component for iOS and Android React-Native apps
MIT License
2.01k stars 852 forks source link

Some of the addresses not returning post code in UK #757

Closed BerkD145 closed 3 years ago

BerkD145 commented 3 years ago

Some of the addresses its not returning postal codes in uk. For example : 251 Menlove Avenue Liverpool ,UK. Some of the addresses only returns first part of the post code. The main problem is that the zip code is not returning.

These are the response i get : [ { "long_name": "251", "short_name": "251", "types": [ "street_number" ] }, { "long_name": "Menlove Avenue", "short_name": "Menlove Ave", "types": [ "route" ] }, { "long_name": "Liverpool", "short_name": "Liverpool", "types": [ "postal_town" ] }, { "long_name": "Merseyside", "short_name": "Merseyside", "types": [ "administrative_area_level_2", "political" ] }, { "long_name": "England", "short_name": "England", "types": [ "administrative_area_level_1", "political" ] }, { "long_name": "United Kingdom", "short_name": "GB", "types": [ "country", "political" ] } ]

In this one i only get some part of the post code : [ { "long_name": "Wendover Street", "short_name": "Wendover St", "types": [ "route" ] }, { "long_name": "High Wycombe", "short_name": "High Wycombe", "types": [ "postal_town" ] }, { "long_name": "Buckinghamshire", "short_name": "Buckinghamshire", "types": [ "administrative_area_level_2", "political" ] }, { "long_name": "England", "short_name": "England", "types": [ "administrative_area_level_1", "political" ] }, { "long_name": "United Kingdom", "short_name": "GB", "types": [ "country", "political" ] }, { "long_name": "HP11", "short_name": "HP11", "types": [ "postal_code_prefix", "postal_code" ] } ]

When i type that address to google its shows me the post code :

Screen Shot 2021-09-07 at 10 42 45
Click to expand! ``` { onPlaceSelected(data, details); props.onClose(); }} renderLeftButton={() => } query={{ key: config.googlePlacesApiKey.key, language: 'en', type: 'address', components: 'country:gb', }} /> ```

Additional context

Thanks

bell-steven commented 3 years ago

This seems to be limitation of the Google Places API for this particular address. I checked other addresses in Liverpool and throughout the UK, and they returned the Postal Code appropriately. Not much can be done on the library end of things here.