-2

i am using @react-google-maps/api for implementing google maps in my react application , on ios 13 and below version i am getting this error and map is not loading SyntaxError: Unexpected token '?' .

import React from "react";
import {
  GoogleMap,
  Circle,
  Marker,
  useJsApiLoader
} from "@react-google-maps/api";

function MyComponent() {
  const libraries = ["geometry", "places"];
  const options = {
    strokeColor: "#3d85c6",
    strokeOpacity: 0.8,
    strokeWeight: 2,
    fillColor: "#66666",
    fillOpacity: 0.35,
    clickable: false,
    draggable: false,
    editable: false,
    visible: true,
    radius: 5,
    zIndex: 12
  };

  const handleBoundsChanged = () => {};

  const zoomChanged = () => {};

  const { isLoaded } = useJsApiLoader({
    id: "script-loader",
    googleMapsApiKey: false,
    language: "en",
    region: "us",
    libraries: libraries
  });
  console.log("isLoaded", isLoaded);
  return (
    <React.Fragment>
      {isLoaded && (
        <>
          <GoogleMap
            onBoundsChanged={handleBoundsChanged}
            mapContainerClassName="App-map"
            zoom={20}
            version="weekly"
            mapContainerStyle={{
              width: 500,
              height: 500
            }}
            options={{
              gestureHandling: "greedy",
              disableDefaultUI: true,
              keyboardShortcuts: false
            }}
            center={{
              lat: 25,
              lng: 25
            }}
            onLoad={() => {}}
            onUnmount={() => {}}
            //onClick={props.onClick}
            onZoomChanged={zoomChanged}
          >
            <Marker
              position={{
                lat: 25,
                lng: 25
              }}
            />
            <Circle
              onUnmount={() => {}}
              center={{
                lat: 25,
                lng: 25
              }}
              options={options}
            />
          </GoogleMap>
        </>
      )}
      {/* {isLoaded ? "" : ""} */}
    </React.Fragment>
  );
}

sandbox link

enter image description here

Wani
  • 61
  • 2
  • 9

0 Answers0