Skip to content

Commit 1f3d406

Browse files
authored
Merge pull request #69 from kevinparkerson/add-input-autocomplete-prop
Add inputAutocompleteValue prop to customize autofill disabling solution
2 parents bdbdd39 + 884d2fa commit 1f3d406

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ export default class ReactGoogleAutocomplete extends React.Component {
77
types: PropTypes.array,
88
componentRestrictions: PropTypes.object,
99
bounds: PropTypes.object,
10-
fields: PropTypes.array
10+
fields: PropTypes.array,
11+
inputAutocompleteValue: PropTypes.string,
1112
};
1213

1314
constructor(props) {
@@ -57,7 +58,7 @@ export default class ReactGoogleAutocomplete extends React.Component {
5758
const observerHack = new MutationObserver(() => {
5859
observerHack.disconnect();
5960
if (this.refs && this.refs.input) {
60-
this.refs.input.autocomplete = 'off';
61+
this.refs.input.autocomplete = this.props.inputAutocompleteValue || 'new-password';
6162
}
6263
});
6364
observerHack.observe(this.refs.input, {
@@ -111,7 +112,6 @@ export class ReactCustomGoogleAutocomplete extends React.Component {
111112
(predictions, status) => {
112113
if (status === 'OK' && predictions && predictions.length > 0) {
113114
this.props.onOpen(predictions);
114-
console.log(predictions);
115115
} else {
116116
this.props.onClose();
117117
}

0 commit comments

Comments
 (0)