google-location-autocomplete-react
Advanced tools
Comparing version 1.0.11 to 1.0.13
@@ -13,3 +13,5 @@ /// <reference types="googlemaps" /> | ||
} | ||
declare const GoogleLocationAutocomplete: React.FC<GoogleAutocompleteProps>; | ||
declare const GoogleLocationAutocomplete: React.FC<GoogleAutocompleteProps> & { | ||
defaultValue?: string; | ||
}; | ||
export default GoogleLocationAutocomplete; |
@@ -24,7 +24,6 @@ var __assign = (this && this.__assign) || function () { | ||
import { jsx as _jsx } from "react/jsx-runtime"; | ||
import React, { useEffect, useRef } from "react"; | ||
import { useEffect, useRef } from "react"; | ||
var GoogleLocationAutocomplete = function (_a) { | ||
var apiKey = _a.apiKey, onPlaceSelected = _a.onPlaceSelected, value = _a.value, props = __rest(_a, ["apiKey", "onPlaceSelected", "value"]); | ||
var apiKey = _a.apiKey, onPlaceSelected = _a.onPlaceSelected, defaultValue = _a.defaultValue, props = __rest(_a, ["apiKey", "onPlaceSelected", "defaultValue"]); | ||
var inputRef = useRef(null); | ||
var _b = React.useState(""), data = _b[0], setData = _b[1]; | ||
var initAutocomplete = function () { | ||
@@ -39,5 +38,4 @@ if (inputRef.current && window.google) { | ||
}); | ||
if (value) { | ||
setData(value); | ||
autocomplete_1.setValue(value); | ||
if (defaultValue) { | ||
autocomplete_1.setValue(defaultValue); | ||
} | ||
@@ -60,4 +58,4 @@ } | ||
}, [apiKey]); | ||
return (_jsx("input", __assign({ ref: inputRef, type: "text", value: data, onChange: function (e) { return setData(e.target.value); } }, props))); | ||
return (_jsx("input", __assign({ ref: inputRef, type: "text" }, props))); | ||
}; | ||
export default GoogleLocationAutocomplete; |
{ | ||
"name": "google-location-autocomplete-react", | ||
"version": "1.0.11", | ||
"version": "1.0.13", | ||
"main": "dist/GoogleLocationAutocomplete.js", | ||
@@ -5,0 +5,0 @@ "types": "dist/GoogleLocationAutocomplete.d.ts", |
5492