react-native-google-autocomplete icon indicating copy to clipboard operation
react-native-google-autocomplete copied to clipboard

normalizeQuery issue

Open ruslan-hontar opened this issue 4 years ago • 2 comments

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

ruslan-hontar avatar Jul 20 '20 14:07 ruslan-hontar

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

EQuimper avatar Jul 21 '20 16:07 EQuimper

@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

ruslan-hontar avatar Jul 23 '20 21:07 ruslan-hontar