Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

google-location-autocomplete-react

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

google-location-autocomplete-react - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

3

dist/GoogleLocationAutocomplete.d.ts

@@ -0,4 +1,6 @@

/// <reference types="googlemaps" />
import React from "react";
interface GoogleAutocompleteProps extends React.InputHTMLAttributes<HTMLInputElement> {
apiKey: string;
onPlaceSelected?: (place: google.maps.places.PlaceResult) => void;
}

@@ -8,2 +10,3 @@ declare global {

initAutocomplete?: () => void;
google?: any;
}

@@ -10,0 +13,0 @@ }

16

dist/GoogleLocationAutocomplete.js

@@ -26,7 +26,13 @@ var __assign = (this && this.__assign) || function () {

var GoogleLocationAutocomplete = function (_a) {
var apiKey = _a.apiKey, props = __rest(_a, ["apiKey"]);
var apiKey = _a.apiKey, onPlaceSelected = _a.onPlaceSelected, props = __rest(_a, ["apiKey", "onPlaceSelected"]);
var inputRef = useRef(null);
var initAutocomplete = function () {
var handlePlaceSelect = function () {
if (inputRef.current) {
new window.google.maps.places.Autocomplete(inputRef.current);
var autocomplete_1 = new window.google.maps.places.Autocomplete(inputRef.current);
autocomplete_1.addListener('place_changed', function () {
var place = autocomplete_1.getPlace();
if (onPlaceSelected) {
onPlaceSelected(place);
}
});
}

@@ -39,3 +45,3 @@ };

}
window.initAutocomplete = initAutocomplete;
window.initAutocomplete = handlePlaceSelect;
var url = "https://maps.googleapis.com/maps/api/js?key=".concat(apiKey, "&libraries=places&callback=initAutocomplete");

@@ -52,5 +58,5 @@ if (!document.querySelector("script[src=\"".concat(url, "\"]"))) {

};
}, [apiKey]);
}, [apiKey, onPlaceSelected]);
return _jsx("input", __assign({ ref: inputRef, type: "text" }, props));
};
export default GoogleLocationAutocomplete;
{
"name": "google-location-autocomplete-react",
"version": "1.0.2",
"version": "1.0.3",
"main": "dist/GoogleLocationAutocomplete.js",

@@ -5,0 +5,0 @@ "types": "dist/GoogleLocationAutocomplete.d.ts",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc