<commit_before>import React, { Component, PropTypes } from 'react'
import I18n from 'react-native-i18n'
import {
  View,
  ToolbarAndroid,
  InteractionManager
} from 'react-native'
import ScrollableTabView from 'react-native-scrollable-tab-view'
import StationsListContainer from './stationsListContainer'
import StationsMapContainer from './stationsMapContainer'
import { FILTER_BIKES, FILTER_SPACES, TYPE_LIST } from '../actions/stations'

class Stations extends Component {
  constructor(props) {
    super(props)
    this.state = {
      render: false
    }
  }
  componentDidMount() {
    InteractionManager.runAfterInteractions(() => {
      this.setState({ render: true })
    })
  }
  render() {
    if (!this.state.render) {
      return null
    }

    return (
      <View
        style={{
          flex: 1,
          backgroundColor: '#000000'
        }}
        >
        <ToolbarAndroid
          title={I18n.t('title')}
          actions={[{
            title: this.props.stationsView.type === TYPE_LIST ? I18n.t('map') : I18n.t('list'),
            titleColor: '#FFFFFF',
            subtitleColor: '#FFFFFF',
            color: '#FFFFFF',
            show: 'always',
          }]}
          titleColor='#FFFFFF'
          onActionSelected={this.props.toggleType}
          style={{
            backgroundColor: '#607D8B',
            height: 56
          }}
          />
        {this.renderContent()}
      </View>
    )
  }
  renderContent() {
    if (this.props.stationsView.type === TYPE_LIST) {
      return (
        <StationsListContainer/>
      )
    }
    else {
      return (
        <View
          style={{
            flex: 1
          }}
          >
          <ScrollableTabView
            initialPage={0}
            tabBarActiveTextColor='#FFC107'
            tabBarInactiveTextColor='#FFFFFF'
            tabBarUnderlineColor='#FFC107'
            tabBarBackgroundColor='#607D8B'
            onChangeTab={this.props.toggleFilter}
            style={{
              flex: 1,
              position: 'absolute',
              top: 0,
              bottom: 0,
              left: 0,
              right: 0
            }}
            >
            <View
              key={FILTER_BIKES}
              tabLabel={I18n.t('bikes').toUpperCase()}
              />
            <View
              key={FILTER_SPACES}
              tabLabel={I18n.t('freeSpaces').toUpperCase()}
              />
          </ScrollableTabView>
          <View
            style={{
              position: 'absolute',
              top: 50,
              bottom: 0,
              left: 0,
              right: 0
            }}
            >
            <StationsMapContainer
              filter={this.props.stationsView.filter}
              style={{
                flex: 1
              }}
              />
          </View>
        </View>
      )
    }
  }
}

Stations.propTypes = {
  toggleFilter: PropTypes.func,
  toggleType: PropTypes.func,
  stationsView: PropTypes.shape({
    filter: PropTypes.string,
    type: PropTypes.string
  })
}

export default Stations
<commit_msg>fix bux on Android showing wrong filter when opening map<commit_after>import React, { Component, PropTypes } from 'react'
import I18n from 'react-native-i18n'
import {
  View,
  ToolbarAndroid,
  InteractionManager
} from 'react-native'
import ScrollableTabView from 'react-native-scrollable-tab-view'
import StationsListContainer from './stationsListContainer'
import StationsMapContainer from './stationsMapContainer'
import { FILTER_BIKES, FILTER_SPACES, TYPE_LIST } from '../actions/stations'

class Stations extends Component {
  constructor(props) {
    super(props)
    this.state = {
      render: false
    }
  }
  componentDidMount() {
    InteractionManager.runAfterInteractions(() => {
      this.setState({ render: true })
    })
  }
  render() {
    if (!this.state.render) {
      return null
    }

    return (
      <View
        style={{
          flex: 1,
          backgroundColor: '#000000'
        }}
        >
        <ToolbarAndroid
          title={I18n.t('title')}
          actions={[{
            title: this.props.stationsView.type === TYPE_LIST ? I18n.t('map') : I18n.t('list'),
            titleColor: '#FFFFFF',
            subtitleColor: '#FFFFFF',
            color: '#FFFFFF',
            show: 'always',
          }]}
          titleColor='#FFFFFF'
          onActionSelected={this.props.toggleType}
          style={{
            backgroundColor: '#607D8B',
            height: 56
          }}
          />
        {this.renderContent()}
      </View>
    )
  }
  renderContent() {
    if (this.props.stationsView.type === TYPE_LIST) {
      return (
        <StationsListContainer/>
      )
    }
    else {
      return (
        <View
          style={{
            flex: 1
          }}
          >
          <ScrollableTabView
            initialPage={0}
            tabBarActiveTextColor='#FFC107'
            tabBarInactiveTextColor='#FFFFFF'
            tabBarUnderlineColor='#FFC107'
            tabBarBackgroundColor='#607D8B'
            onChangeTab={({ i }) => {
              if (i === 0 && this.props.stationsView.filter === FILTER_SPACES) {
                this.props.toggleFilter()
              }
              else if (i === 1 && this.props.stationsView.filter === FILTER_BIKES) {
                this.props.toggleFilter()
              }
            }}
            style={{
              flex: 1,
              position: 'absolute',
              top: 0,
              bottom: 0,
              left: 0,
              right: 0
            }}
            >
            <View
              key={FILTER_BIKES}
              tabLabel={I18n.t('bikes').toUpperCase()}
              />
            <View
              key={FILTER_SPACES}
              tabLabel={I18n.t('freeSpaces').toUpperCase()}
              />
          </ScrollableTabView>
          <View
            style={{
              position: 'absolute',
              top: 50,
              bottom: 0,
              left: 0,
              right: 0
            }}
            >
            <StationsMapContainer
              filter={this.props.stationsView.filter}
              style={{
                flex: 1
              }}
              />
          </View>
        </View>
      )
    }
  }
}

Stations.propTypes = {
  toggleFilter: PropTypes.func,
  toggleType: PropTypes.func,
  stationsView: PropTypes.shape({
    filter: PropTypes.string,
    type: PropTypes.string
  })
}

export default Stations

{'fraction_non_alphanumeric': 0.11694290976058933, 'fraction_numerical': 0.01565377532228361, 'mean_word_length': 1.4836128048780488, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 32, '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': '3727361', 'n_tokens_mistral': 1905, 'n_tokens_neox': 1849, 'n_words': 337}