react-native-google-autocomplete
react-native-google-autocomplete copied to clipboard
normalizeQuery issue
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",
expected: don't receive addresses that aren't within a radius of 35 km from lat
& lng
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 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