<commit_before>import React from 'react';
import styles from '../Field/styles.css';

export default class LocationField extends React.Component {
  static propTypes = {
    label: React.PropTypes.string,
    name: React.PropTypes.string,
    callback: React.PropTypes.func,
  }
  constructor(props) {
    super(props);
    this.onBlur = this.onBlur.bind(this);
    this.onFocus = this.onFocus.bind(this);
  }
  componentDidMount() {
    const options = { types: ['geocode'] };
    const element = this.refs.input;
    const autocomplete = new window.google.maps.places.Autocomplete(element, options);
    window.google.maps.event.addListener(autocomplete,
      'place_changed',
      () => {
        this.setState({ clean: true });
        return this.props.callback ? this.props.callback(autocomplete) : autocomplete.getPlace();
      }
    );
  }
  onBlur(event) {
    if (!this.state.clean) {
      event.target.value = '';
    }
  }
  onFocus() {
    this.setState({ clean: false });
  }
  render() {
    const { label, name } = this.props;
    const attrs = {
      type: 'text',
      label,
      name,
      ref: 'input',
      onBlur: this.onBlur,
      onFocus: this.onFocus
    };
    return (<commit_msg>Google location field nochange fix<commit_after>import React from 'react';
import styles from '../Field/styles.css';

export default class LocationField extends React.Component {
  static propTypes = {
    label: React.PropTypes.string,
    name: React.PropTypes.string,
    callback: React.PropTypes.func,
  }
  constructor(props) {
    super(props);
    this.onBlur = this.onBlur.bind(this);
    this.onFocus = this.onFocus.bind(this);
  }
  componentDidMount() {
    const options = { types: ['geocode'] };
    const element = this.refs.input;
    const autocomplete = new window.google.maps.places.Autocomplete(element, options);
    window.google.maps.event.addListener(autocomplete,
      'place_changed',
      () => {
        this.setState({ clean: true });
        return this.props.callback ? this.props.callback(autocomplete) : autocomplete.getPlace();
      }
    );
  }
  onBlur(event) {
    if (!this.state.clean) {
      event.target.value = '';
    }
  }
  onFocus() {
    this.setState({ clean: false });
  }
  render() {
    const { label, name } = this.props;
    const attrs = {
      type: 'text',
      label,
      name,
      ref: 'input',
      onBlur: this.onBlur,
      onChange: this.onFocus
    };
    return (
{'fraction_non_alphanumeric': 0.13925081433224756, 'fraction_numerical': 0.0, 'mean_word_length': 2.7170953101361572, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2348690', 'n_tokens_mistral': 787, 'n_tokens_neox': 778, 'n_words': 156}