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

react-google-autocomplete

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-google-autocomplete - npm Package Compare versions

Comparing version 1.0.16 to 1.0.17

39

lib/index.js

@@ -61,2 +61,4 @@ 'use strict';

this.disableAutofill();
this.autocomplete = new google.maps.places.Autocomplete(this.refs.input, config);

@@ -67,2 +69,19 @@

}, {
key: 'disableAutofill',
value: function disableAutofill() {
var _this2 = this;
// Autofill workaround adapted from https://stackoverflow.com/questions/29931712/chrome-autofill-covers-autocomplete-for-google-maps-api-v3/49161445#49161445
if (window.MutationObserver) {
var observerHack = new MutationObserver(function () {
observerHack.disconnect();
_this2.refs.input.autocomplete = 'disable-autofill';
});
observerHack.observe(this.refs.input, {
attributes: true,
attributeFilter: ['autocomplete']
});
}
}
}, {
key: 'componentWillUnmount',

@@ -112,6 +131,6 @@ value: function componentWillUnmount() {

var _this2 = _possibleConstructorReturn(this, (ReactCustomGoogleAutocomplete.__proto__ || Object.getPrototypeOf(ReactCustomGoogleAutocomplete)).call(this, props));
var _this3 = _possibleConstructorReturn(this, (ReactCustomGoogleAutocomplete.__proto__ || Object.getPrototypeOf(ReactCustomGoogleAutocomplete)).call(this, props));
_this2.service = new google.maps.places.AutocompleteService();
return _this2;
_this3.service = new google.maps.places.AutocompleteService();
return _this3;
}

@@ -122,3 +141,3 @@

value: function onChange(e) {
var _this3 = this;
var _this4 = this;

@@ -132,6 +151,6 @@ var _props$types2 = this.props.types,

if (status === 'OK' && predictions && predictions.length > 0) {
_this3.props.onOpen(predictions);
_this4.props.onOpen(predictions);
console.log(predictions);
} else {
_this3.props.onClose();
_this4.props.onClose();
}

@@ -146,3 +165,3 @@ });

value: function componentDidMount() {
var _this4 = this;
var _this5 = this;

@@ -153,3 +172,3 @@ if (this.props.input.value) {

if (status === 'OK') {
_this4.refs.input.value = e.formatted_address;
_this5.refs.input.value = e.formatted_address;
}

@@ -162,3 +181,3 @@ });

value: function render() {
var _this5 = this;
var _this6 = this;

@@ -171,3 +190,3 @@ return _react2.default.createElement(

onChange: function onChange(e) {
_this5.onChange(e);
_this6.onChange(e);
}

@@ -174,0 +193,0 @@ })),

{
"name": "react-google-autocomplete",
"version": "1.0.16",
"version": "1.0.17",
"description": "React component for google autocomplete.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -29,2 +29,4 @@ import React from 'react';

this.disableAutofill();
this.autocomplete = new google.maps.places.Autocomplete(this.refs.input, config);

@@ -35,2 +37,16 @@

disableAutofill() {
// Autofill workaround adapted from https://stackoverflow.com/questions/29931712/chrome-autofill-covers-autocomplete-for-google-maps-api-v3/49161445#49161445
if (window.MutationObserver) {
const observerHack = new MutationObserver(() => {
observerHack.disconnect();
this.refs.input.autocomplete = 'disable-autofill';
});
observerHack.observe(this.refs.input, {
attributes: true,
attributeFilter: ['autocomplete'],
});
}
}
componentWillUnmount() {

@@ -37,0 +53,0 @@ this.event.remove();

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