|
@@ -1,26 +1,7 @@
|
|
|
import React, { useRef, useEffect } from "react";
|
|
|
+import useMap from "../../../hooks/useMap";
|
|
|
/* global google */
|
|
|
|
|
|
-const useMap = () => {
|
|
|
- const mapDiv = useRef(null);
|
|
|
- const map = useRef(null);
|
|
|
- useEffect(() => {
|
|
|
- if (map.current) {
|
|
|
- console.log("Attempted to re-run effect with existing Map");
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- map.current = new google.maps.Map(mapDiv.current, {
|
|
|
- center: { lat: 25, lng: -25 },
|
|
|
- zoom: 0,
|
|
|
- disableDefaultUI: true,
|
|
|
- fullscreenControl: true,
|
|
|
- });
|
|
|
- }, []);
|
|
|
-
|
|
|
- return [mapDiv, map];
|
|
|
-}
|
|
|
-
|
|
|
const useClickMarker = (map, onMove) => {
|
|
|
const marker = useRef(null);
|
|
|
useEffect(() => {
|