react-google-maps-api icon indicating copy to clipboard operation
react-google-maps-api copied to clipboard

Autocomplete not working

Open bsgies opened this issue 2 years ago • 4 comments

Hi, community,

I am using this library in NextJS to show Google Maps with a marker and to use Autocomplete. For some reason, the autcomplete doesn't seem to work at all.

My current structure is like this:

const googleMapsLibraries = ['places'] const { isLoaded } = useJsApiLoader({ googleMapsApiKey: "API_KEY", libraries: googleMapsLibraries, }); const [center, setCenter] = useState({ lat: 51.60716225432206, lng: 0.0006820025611930045, }); if (!isLoaded) { return <CircularProgress size={50} thickness={50} />; }

<Grid item xs={12}> <Autocomplete> <InputField fullWidth label={t("address_label")} placeholder={t("address_placeholder")} type="text" className="os" /> </Autocomplete> </Grid> <Grid item xs={12}> <Box sx={{ height: "300px", }} > <GoogleMap mapContainerStyle={{ width: "100%", height: "100%", }} center={center} zoom={15} options={{ zoomControl: false, streetViewControl: false, mapTypeControl: false, }} > <MarkerF animation="bounce" draggable={true} position={center} icon={"/img/marker.svg"} /> </GoogleMap> </Box> </Grid>

image

If you notice the screenshot, there are no suggestions for a or ab or abc.

How should I fix it?

bsgies avatar Aug 23 '23 11:08 bsgies

I have the same issue..has anyone managed to solve this? @JustFly1984 @uriklar I know you are not activly working on this anymore - but do you happen to know what is the issue?

bentsirouteit avatar Feb 18 '25 20:02 bentsirouteit

Can you share any errors you're receiving? A codesandbox recreation would go a long way...

uriklar avatar Feb 24 '25 16:02 uriklar

I have a similar issue where Autocomplete seems to work on my dev env, but I check it on server, It doesnt seem to work.

muftisamiullah avatar Apr 24 '25 10:04 muftisamiullah

I think u should check the z-index prop on the .pac-container

try adding this in your css

.pac-container {
    z-index: 999999999 !important;
}

this fixed the issue for me

muftisamiullah avatar Apr 24 '25 17:04 muftisamiullah