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

normalizeQuery issue #40

Open
ruslan-hontar opened this issue Jul 20, 2020 · 2 comments
Open

normalizeQuery issue #40

ruslan-hontar opened this issue Jul 20, 2020 · 2 comments

Comments

@ruslan-hontar
Copy link

queryTypes & radius are work incorrectly
components={'country:us'} works correct
looks like other queries work wrong

code

<GoogleAutoComplete
  apiKey={googleMapKey}
  debounce={300}
  language={'us'}
  // New York
  lat={40.73061}
  lng={-73.935242}
  // take 35km radius
  radius={'35000'}
  queryTypes={'geocode'}
  components={'country:us'}
>
  {({ inputValue, handleTextChange, locationResults }) => (
    <>
      <Field
        name="location"
        topLabel={'Property Location'}
        placeholder={'Enter location'}
        component={MaterialInput}
        disableLabel={true}
        labelColor={Colors.Black}
        locationIcon={true}
        geolocationValue={inputValue}
        handleTextChange={handleTextChange}
      />
      {inputValue && inputValue.length >= 2 ? (
        <ScrollView style={{ maxHeight: 300 }}>
          {locationResults.map(
            (locationElement: GoogleLocationResult, i: number) => (
              <LocationElement
                key={String(i)}
                locationElement={locationElement}
                isImageLoading={isImageLoading}
                setImageLoading={setImageLoading}
              />
            ),
          )}
        </ScrollView>
      ) : null}
    </>
  )}
</GoogleAutoComplete>

env:
OS: macOS 10.15.6
"react-native": "0.62.2",
"react-native-google-autocomplete": "^0.1.9",

Screenshot 2020-07-20 at 17 54 38

expected: don't receive addresses that aren't within a radius of 35 km from lat & lng

@EQuimper
Copy link
Member

Umh ok I think the issue is I need to use a circular query if your provide all 3 items

Circular: A string specifying radius in meters, plus lat/lng in decimal degrees.
Use the following format: circle:radius@lat,lng.

@ruslan-hontar do you think this is what you need ? Never did use it but from what I read he look like this is the solution

@ruslan-hontar
Copy link
Author

ruslan-hontar commented Jul 23, 2020

@EQuimper also saw this in google docs , but unfortunately, this solution doesn't work for me. solved my problem with fetchDetails callBack. I upload more information and check by geometry props if this place correct for my filter. But this looks like a temporary solution. unfortunately, filter with queryTypes prop also doesn't work for me

I think the solution is to create new prop strictbounds. I found some information about the radius & strictbounds parameters here, but I still confusing why queryTypes doesn't work

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