<commit_before>import React, { Component } from 'react'
import { connect } from 'react-redux'
import { Text, ListView, View, TouchableOpacity } from 'react-native'
import { Actions } from 'react-native-router-flux'

import styles from '../styles/stylesheet'
import strings from '../resources/translations'

class StartView extends Component{
  constructor(props) {
    super(props)

    this.state = {
    }
  }

  render(renderData) {
    const goToBusListView = () => Actions.departures()

    return (
      <View style={styles.start}>
        <TouchableOpacity onPress={goToBusListView}>
          <Text style={styles.startText}>{strings.onStop}</Text>
        </TouchableOpacity>
        <TouchableOpacity onPress={goToBusListView}>
          <Text style={styles.startText}>{strings.onBus}</Text>
        </TouchableOpacity>
      </View>
    )
  }
}

export default StartView;<commit_msg>location is now dispatched to store in start view<commit_after>import React, { Component } from 'react'
import { connect } from 'react-redux'
import { Text, ListView, View, TouchableOpacity } from 'react-native'

import styles from '../styles/stylesheet'
import strings from '../resources/translations'

import StartViewButtons from './StartViewButtons'

import { setLocation } from '../actions/locationActions'

class StartView extends Component{
  constructor(props) {
    super(props)

    this.state = {
      locationData: '',
      gotLocation: false,
      locationError: false
    }

    this.getCurrentLocation()
  }

  getCurrentLocation = () => {
    navigator.geolocation.getCurrentPosition(
      (position) =>
      {
        this.props.setLocation(position.coords)
        this.setState({locationData: position.coords, gotLocation: true})
      },
      (error) =>
      {
        this.setState({locationData: '', locationError: true})
      },
      {
        enableHighAccuracy: true,
        timeout: 20000,
        maximumAge: 1000
      })
  }

  render() {
    let viewElement

    if(this.state.locationError) {
        viewElement = <View>
        <Text style={styles.locationErrorText}>{strings.locationError}</Text>
        <TouchableOpacity onPress={this.getCurrentLocation()}><Text style={{textAlign: 'center', color: '#0000ff'}}>{strings.tryAgain}</Text></TouchableOpacity>
        </View>
    } else {
      if(this.state.gotLocation) {
        viewElement = <StartViewButtons />
      } else {
        viewElement = <View><Text style={styles.gettingLocationText}>{strings.gettingLocation}</Text></View>
      }
    }

    return (
      <View style={styles.start}>
      {viewElement}
        </View>
    )
  }
}
const mapStateToProps = (state) => {
  return {

  }
}

const mapDispatchToProps = (dispatch) => {
  return {
      setLocation: (locationData) => {
        dispatch(setLocation(locationData))
      }
    }
}

export default connect(mapStateToProps, mapDispatchToProps)(StartView);
{'fraction_non_alphanumeric': 0.12988348183687456, 'fraction_numerical': 0.004455106237148732, 'mean_word_length': 3.0485436893203883, 'pattern_counts': {'":': 0, '<': 28, '<?xml version=': 0, '>': 35, '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': '3072178', 'n_tokens_mistral': 870, 'n_tokens_neox': 844, 'n_words': 169}