<commit_before>'use strict';

import {
  View,
  Text,
  TouchableHighlight,
  Alert,
  TextInput,
  ListView,
  ScrollView,
} from 'react-native'
import axios from 'axios'

import React, { Component, PropTypes } from 'react';
import styles from '../styles/styles';

import Rating from './rating';
import ImageBar from './imagebar'

export default class PostIt extends Component {

  constructor(props) {
    console.log("POSTIT PROPS", props);
    super(props);
    this.state = {
      dataSource: new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2}),
      user_id: 1,
      positive: this.props.userRating,
      comment: null,
      image: null,
      latitude: this.props.userLat,
      longitude: this.props.userLng,
      timestamp: new Date().toUTCString(),
      tag_ids: this.props.userTags,
      tagNames: this.props.userTagNames
    }
    this.imgSelected = this.imgSelected.bind(this)
  }

  componentDidMount() {
    console.log(this.state);
    // makes a call to get formatted address
    axios.get(`https://maps.googleapis.com/maps/api/geocode/json?latlng=${this.state.latitude},${this.state.longitude}&key=<KEY>`)
    .then( geo => {
      let addressFromGoogle = geo.data.results[0].formatted_address
      this.setState({
        formattedAddress: '37204'
        // formattedAddress: addressFromGoogle.replace(/[, ]+/g, " ").trim()
      })
      console.log("STATE ON COMP MOUNT", this.state);
    })
  }

  imgSelected(uri) {
    this.setState({image: uri})
    // console.log(this.state);
  }

  // feedback for successful post
  _thanksForPost = () => {
    axios.post(`https://buzzpoint.herokuapp.com/api/posts`, this.state)
    .then( res => {
      this.setState({
        positive: null,
        comment: null,
        image: null,
        latitude: this.props.userLat,
        longitude: this.props.userLng,
        tag_ids: [],
        tagNames: []
      })
    })

    .catch( err => console.log(err))
  }

  render() {<commit_msg>fixed address<commit_after>'use strict';

import {
  View,
  Text,
  TouchableHighlight,
  Alert,
  TextInput,
  ListView,
  ScrollView,
} from 'react-native'
import axios from 'axios'

import React, { Component, PropTypes } from 'react';
import styles from '../styles/styles';

import Rating from './rating';
import ImageBar from './imagebar'

export default class PostIt extends Component {

  constructor(props) {
    console.log("POSTIT PROPS", props);
    super(props);
    this.state = {
      dataSource: new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2}),
      user_id: 1,
      positive: this.props.userRating,
      comment: null,
      image: null,
      latitude: this.props.userLat,
      longitude: this.props.userLng,
      timestamp: new Date().toUTCString(),
      tag_ids: this.props.userTags,
      tagNames: this.props.userTagNames
    }
    this.imgSelected = this.imgSelected.bind(this)
  }

  componentDidMount() {
    console.log(this.state);
    // makes a call to get formatted address
    axios.get(`https://maps.googleapis.com/maps/api/geocode/json?latlng=${this.state.latitude},${this.state.longitude}&key=<KEY>`)
    .then( geo => {
      let addressFromGoogle = geo.data.results[0].formatted_address
      this.setState({
        formattedAddress: addressFromGoogle.replace(/[, ]+/g, " ").trim()
      })
      console.log("STATE ON COMP MOUNT", this.state);
    })
  }

  imgSelected(uri) {
    this.setState({image: uri})
    // console.log(this.state);
  }

  // feedback for successful post
  _thanksForPost = () => {
    axios.post(`https://buzzpoint.herokuapp.com/api/posts`, this.state)
    .then( res => {
      this.setState({
        positive: null,
        comment: null,
        image: null,
        latitude: this.props.userLat,
        longitude: this.props.userLng,
        tag_ids: [],
        tagNames: []
      })
    })

    .catch( err => console.log(err))
  }

  render() {
{'fraction_non_alphanumeric': 0.14636015325670498, 'fraction_numerical': 0.004342273307790549, 'mean_word_length': 2.7690086621751684, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, 'https://': 4, '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': '2807191', 'n_tokens_mistral': 1294, 'n_tokens_neox': 1259, 'n_words': 261}