We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent be9d081 commit e1b3a7eCopy full SHA for e1b3a7e
src/hooks/max-zoom.ts
@@ -0,0 +1,25 @@
1
+import {useMemo} from 'react';
2
+
3
+import useGoogleMap from './map-instance';
4
5
+/**
6
+ * Hook to get Max Zoom Service instance
7
+ */
8
+const useMaxZoomService = (): google.maps.MaxZoomService | null => {
9
+ const {map} = useGoogleMap();
10
11
+ // Creates a Max Zoom Service instance
12
+ const maxZoomService =
13
+ useMemo<google.maps.MaxZoomService | null>(() => {
14
+ // Wait for map to be initialized
15
+ if (!map) {
16
+ return null;
17
+ }
18
19
+ return new google.maps.MaxZoomService();
20
+ }, [map]);
21
22
+ return maxZoomService;
23
+};
24
25
+export default useMaxZoomService;
0 commit comments