You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP

@vis.gl/react-google-maps

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vis.gl/react-google-maps - npm Package Compare versions

Comparing version

to
0.4.1

@@ -1222,7 +1222,10 @@ (function (global, factory) {

}
var _ref = React.useContext(APIProviderContext) || {},
_ref$mapInstances = _ref.mapInstances,
mapInstances = _ref$mapInstances === void 0 ? {} : _ref$mapInstances;
var _ref2 = React.useContext(GoogleMapsContext) || {},
map = _ref2.map;
var ctx = React.useContext(APIProviderContext);
var _ref = React.useContext(GoogleMapsContext) || {},
map = _ref.map;
if (ctx === null) {
logErrorOnce('useMap(): failed to retrieve APIProviderContext. ' + 'Make sure that the <APIProvider> component exists and that the ' + 'component you are calling `useMap()` from is a sibling of the ' + '<APIProvider>.');
return null;
}
var mapInstances = ctx.mapInstances;
// if an id is specified, the corresponding map or null is returned

@@ -1229,0 +1232,0 @@ if (id !== null) return mapInstances[id] || null;

{
"name": "@vis.gl/react-google-maps",
"version": "0.4.0",
"version": "0.4.1",
"description": "React components and hooks for Google Maps.",

@@ -52,2 +52,5 @@ "source": "src/index.ts",

],
"dependencies": {
"@types/google.maps": "^3.54.10"
},
"peerDependencies": {

@@ -62,3 +65,2 @@ "react": ">=16.8.0",

"@testing-library/user-event": "^14.4.3",
"@types/google.maps": "^3.50.5",
"@types/jest": "^29.4.0",

@@ -81,4 +83,4 @@ "@typescript-eslint/eslint-plugin": "^6.4.1",

"typescript": "^5.1.6",
"vite": "^4.5.0"
"vite": "^5.0.4"
}
}

@@ -5,2 +5,3 @@ import {useContext} from 'react';

import {GoogleMapsContext} from '../components/map';
import {logErrorOnce} from '../libraries/errors';

@@ -13,5 +14,18 @@ /**

export const useMap = (id: string | null = null): google.maps.Map | null => {
const {mapInstances = {}} = useContext(APIProviderContext) || {};
const ctx = useContext(APIProviderContext);
const {map} = useContext(GoogleMapsContext) || {};
if (ctx === null) {
logErrorOnce(
'useMap(): failed to retrieve APIProviderContext. ' +
'Make sure that the <APIProvider> component exists and that the ' +
'component you are calling `useMap()` from is a sibling of the ' +
'<APIProvider>.'
);
return null;
}
const {mapInstances} = ctx;
// if an id is specified, the corresponding map or null is returned

@@ -18,0 +32,0 @@ if (id !== null) return mapInstances[id] || null;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet