Skip to content

Commit 77561da

Browse files
committed
bump 2.7.1
1 parent d43ba53 commit 77561da

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

lib/usePlacesWidget.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,14 @@ function usePlacesWidget(props) {
7777
if (!google.maps.places) return console.error("Google maps places API must be loaded.");
7878
if (!inputRef.current instanceof HTMLInputElement) return console.error("Input ref must be HTMLInputElement.");
7979
autocompleteRef.current = new google.maps.places.Autocomplete(inputRef.current, config);
80-
event.current = autocompleteRef.current.addListener("place_changed", function () {
81-
if (onPlaceSelected && autocompleteRef && autocompleteRef.current) {
82-
onPlaceSelected(autocompleteRef.current.getPlace(), inputRef.current, autocompleteRef.current);
83-
}
84-
});
80+
81+
if (autocompleteRef.current) {
82+
event.current = autocompleteRef.current.addListener("place_changed", function () {
83+
if (onPlaceSelected && autocompleteRef && autocompleteRef.current) {
84+
onPlaceSelected(autocompleteRef.current.getPlace(), inputRef.current, autocompleteRef.current);
85+
}
86+
});
87+
}
8588
};
8689

8790
if (apiKey) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-google-autocomplete",
3-
"version": "2.7.0",
3+
"version": "2.7.1",
44
"description": "React component for google autocomplete.",
55
"main": "index.js",
66
"types": "index.d.ts",

0 commit comments

Comments
 (0)