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

Street number truncated off of selected place for details query for certain addresses #838

Open natalie-zamani opened 2 years ago

natalie-zamani commented 2 years ago

Describe the bug

For certain places that are selected in the typeahead options, the street number is always truncated off in the fetch details query, which results in the details being for the incomplete address.

Reproduction - (required - issue will be closed without this)

Can always reproduce using the address: 2 Relmar Road, Toronto, ON, Canada, where the query made to fetch details is: "https://maps.google.com/?q=Relmar+Rd,+Toronto,+ON+M5P,+Canada. This removes the 2 street number, and results in the wrong address being returned.

Additional context

If you are using expo please indicate here:

Add any other context about the problem here, screenshots etc

GooglePlaceData

{description: "2 Relmar Road, Toronto, ON, Canada", ...}

GooglePlaceDetail

address_components: Array(7)
  0: {long_name: "Relmar Road", short_name: "Relmar Rd", types: ["route"]}
  1: {long_name: "Old Toronto", short_name: "Old Toronto", types: Array(3)}
  2: {long_name: "Toronto", short_name: "Toronto", types: Array(2)}
  3: {long_name: "Toronto", short_name: "Toronto", types: Array(2)}
  4: {long_name: "Ontario", short_name: "ON", types: Array(2)}
  5: {long_name: "Canada", short_name: "CA", types: Array(2)}
  6: {long_name: "M5P", short_name: "M5P", types: Array(2)}
formatted_address: "Relmar Rd, Toronto, ON M5P, Canada"
natalie-zamani commented 2 years ago

Happy to try opening a PR for this issue, but it's not clear if this library is still maintained, and I'd rather get confirmation from a contributor that it's worth doing so first.

derickdecesare commented 5 months ago

Hi wondering if you ever found a solution for this. I am running into this problem for certain addresses near Toronto as well.