react-native-google-places-autocomplete
                                
                                
                                
                                    react-native-google-places-autocomplete copied to clipboard
                            
                            
                            
                        Need to show only addresses with a house number
Describe the problem
I want to exclude all results without street addresses and home numbers. I tried with different values for filterReverseGeocodingByTypes but each time i received Country, City or something like that in dropdown results. Also i searched solution in google api but didn't find it.
Additional context
react-native-geolocation-service: ^5.3.0-beta.3
react-native-google-places-autocomplete: ^2.4.1
- 
Library Version: [e.g. 1.4.2]
 - 
React Native Version: [^0.65.1]
 - 
[ ] iOS
 - 
[ ] Android
 - 
[ ] Web
 
If you are using expo please indicate here:
- [ ] I am using expo
 
Could you solve this issue? Im using filterReverseGeocodingByTypes={['establishment','street_address']} but it doesn't work
@sirtok4 sorry for the long response. Actually no, i have not found any option to do it. Instead of i've added validation that checking that an address includes country name, street name and any number as a street name
@valin0k thanks for the answer! Yea I found a different way to do it as well
query={{ "key":"key", "language":"en", "components":"country:us", "sessiontoken":"sessionToken", "type":"address" }}
Adding the type property filters more.
@valin0k thanks for the answer! Yea I found a different way to do it as well
Sorry what solution did you find for this?
Anyone have a solution for this? "type":"address" still returns addresses with no street/street # and "types": ['street_number', 'street_address'] in the query or GooglePlacesSearchQuery does not work.
Hi @jenniredfield
I dont remember exactly but I guess I ended up formatting the address in the onPress param like this:
onPress={(data, details = null) => {
                var addressName = null, postalCode = null, numberStreet = null;
                if (details.address_components) {
                    for (const obj of details.address_components) {
                        if (obj.types.includes('route')) addressName = obj.short_name;
                        else if (obj.types.includes('street_number')) numberStreet = obj.long_name;
                        else if (obj.types.includes('postal_code')) postalCode = obj.long_name;
                }}
}