Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not able to search by typing full address on search bar, getting error for length of undefined using this code. #15

Closed
yogita3279 opened this issue Apr 5, 2020 · 7 comments

Comments

@yogita3279
Copy link

yogita3279 commented Apr 5, 2020

I used GooglePlacesAutocomplete, Link- https://www.npmjs.com/package/react-google-places-autocomplete and it worked

@iaminawe
Copy link

iaminawe commented Aug 7, 2020

I am also getting length undefined error on autocomplete- this issue should still be open

@yogita3279
Copy link
Author

Hi, try with GooglePlacesAutocomplete Link- https://www.npmjs.com/package/react-google-places-autocomplete instead of Autocomplete?

@yogita3279
Copy link
Author

I am also getting length undefined error on autocomplete- this issue should still be open
Try this https://www.npmjs.com/package/react-google-places-autocomplete

@yogita3279 yogita3279 reopened this Aug 7, 2020
@iaminawe
Copy link

iaminawe commented Aug 7, 2020

Thank you for responding. I did try that alternative autocomplete package and while it worked for me in that it returned lookup results - I was not able to get it to work correctly with the map and input fields

Can you please share what your code for the autocomplete part looks like

          <Autocomplete
              style={{
                width: '100%',
                height: '40px',
                paddingLeft: '16px',
                marginTop: '2px',
                marginBottom: '500px'
              }}
              onPlaceSelected={ this.onPlaceSelected }
              types={['(regions)']}
            />

Thanks for posting the example above - would this part be a direct replacement or would it still need some adjustment

 <GooglePlacesAutocomplete
            onSelect={({ description }) => (
                Geocode.fromAddress(description).then(
                response => {
                    const { lat, lng } = response.results[0].geometry.location;
                    const address=response.results[0].formatted_address
                    console.log(lat, lng, address);
                        this.setState( {
                        address: ( address ) ? description : '',
                        markerPosition: {
                            lat: lat,
                            lng: lng
                        },
                        mapPosition: {
                            lat: lat,
                            lng: lng
                        },
                        } )
                    },
                    error => {
                    console.error(error);
                    }
                )
            )}/>

@iaminawe
Copy link

iaminawe commented Aug 7, 2020

That works as a direct replacement - Thank you so much - this can be closed again

@yogita3279 yogita3279 reopened this Aug 7, 2020
@yogita3279
Copy link
Author

:) No worries!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants