<commit_before>import { FlatList, View, Platform } from 'react-native';
import { NavigationActions } from 'react-navigation';
import { SearchBar, ListItem } from 'react-native-elements';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import React from 'react';
import NavBarIcon from '../../components/foiRequests/NavBarIcon';

import { searchUpdateQuery } from '../../actions/search';
import styles from './styles';
import I18n from '../../i18n';
import { greyDark, fontColor, primaryColor } from '../../globals/colors';

class SearchStartScreen extends React.Component {
  _onSubmit = queryText => {
    this.props.navigateToResults({ query: queryText });
    this.props.updateQuery(queryText);
  };

  _onSubmitSearchBar = event => {
    const queryText = event.nativeEvent.text.trim();
    this._onSubmit(queryText);
  };

  _renderItem = ({ item: query }) => {
    return (
      <ListItem
        key={query}
        title={query}
        leftIcon={{ name: 'access-time', color: greyDark }}
        rightIcon={{ name: 'search', color: primaryColor }}
        onPress={() => this._onSubmit(query)}
        titleStyle={{ color: fontColor }}
      />
    );
  };

  render() {
    const size = Platform.OS === 'ios' ? 35 : 26; // for icon
    return (
      <View style={styles.background} keyboardShouldPersistTaps="handled">
        <SearchBar
          lightTheme
          icon={{
            type: 'material',
            color: greyDark,
            name: 'search',
            size,
          }}
          clearIcon={{
            color: greyDark,
            name: 'clear',
            size,
          }}
          textInputRef="searchInput"
          placeholder="Berlin, Schule, NSA..."
          onSubmitEditing={this._onSubmitSearchBar}
          autoFocus
          autoCorrect={false}
          containerStyle={styles.searchBarContainer}
          inputStyle={styles.searchBarInput}
          round
        />
        <FlatList
          data={this.props.pastQueries}
          renderItem={this._renderItem}
          keyboardShouldPersistTaps="handled"
        />
      </View>
    );
  }
}

SearchStartScreen.navigationOptions = ({ navigation }) => {
  const navigateToAlerts = () =>
    navigation.dispatch(
      NavigationActions.navigate({ routeName: 'SearchAlerts' })
    );
  return {
    title: I18n.t('search'),
    headerRight: (
      <NavBarIcon onPress={navigateToAlerts} iconName="notifications" />
    ),
  };
};

SearchStartScreen.propTypes = {
  pastQueries: PropTypes.arrayOf(PropTypes.string).isRequired,
  updateQuery: PropTypes.func.isRequired,
  navigateToResults: PropTypes.func.isRequired,
};

const mapStateToProps = state => {
  return {
    pastQueries: state.search.pastQueries,
  };
};

const mapDispatchToProps = dispatch => {
  return {
    updateQuery: query => dispatch(searchUpdateQuery(query)),
    navigateToResults: params =>
      dispatch(
        NavigationActions.navigate({ routeName: 'SearchResults', params })
      ),
  };
};

export default connect(
  mapStateToProps,
  mapDispatchToProps
)(SearchStartScreen);
<commit_msg>hide alert screen for now<commit_after>import { FlatList, View, Platform } from 'react-native';
import { NavigationActions } from 'react-navigation';
import { SearchBar, ListItem } from 'react-native-elements';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import React from 'react';
import NavBarIcon from '../../components/foiRequests/NavBarIcon';

import { searchUpdateQuery } from '../../actions/search';
import styles from './styles';
import I18n from '../../i18n';
import { greyDark, fontColor, primaryColor } from '../../globals/colors';

class SearchStartScreen extends React.Component {
  _onSubmit = queryText => {
    this.props.navigateToResults({ query: queryText });
    this.props.updateQuery(queryText);
  };

  _onSubmitSearchBar = event => {
    const queryText = event.nativeEvent.text.trim();
    this._onSubmit(queryText);
  };

  _renderItem = ({ item: query }) => {
    return (
      <ListItem
        key={query}
        title={query}
        leftIcon={{ name: 'access-time', color: greyDark }}
        rightIcon={{ name: 'search', color: primaryColor }}
        onPress={() => this._onSubmit(query)}
        titleStyle={{ color: fontColor }}
      />
    );
  };

  render() {
    const size = Platform.OS === 'ios' ? 35 : 26; // for icon
    return (
      <View style={styles.background} keyboardShouldPersistTaps="handled">
        <SearchBar
          lightTheme
          icon={{
            type: 'material',
            color: greyDark,
            name: 'search',
            size,
          }}
          clearIcon={{
            color: greyDark,
            name: 'clear',
            size,
          }}
          textInputRef="searchInput"
          placeholder="Berlin, Schule, NSA..."
          onSubmitEditing={this._onSubmitSearchBar}
          autoFocus
          autoCorrect={false}
          containerStyle={styles.searchBarContainer}
          inputStyle={styles.searchBarInput}
          round
        />
        <FlatList
          data={this.props.pastQueries}
          renderItem={this._renderItem}
          keyboardShouldPersistTaps="handled"
        />
      </View>
    );
  }
}

SearchStartScreen.navigationOptions = ({ navigation }) => {
  const navigateToAlerts = () =>
    navigation.dispatch(
      NavigationActions.navigate({ routeName: 'SearchAlerts' })
    );
  return {
    title: I18n.t('search'),
    // headerRight: (
    //   <NavBarIcon onPress={navigateToAlerts} iconName="notifications" />
    // ),
  };
};

SearchStartScreen.propTypes = {
  pastQueries: PropTypes.arrayOf(PropTypes.string).isRequired,
  updateQuery: PropTypes.func.isRequired,
  navigateToResults: PropTypes.func.isRequired,
};

const mapStateToProps = state => {
  return {
    pastQueries: state.search.pastQueries,
  };
};

const mapDispatchToProps = dispatch => {
  return {
    updateQuery: query => dispatch(searchUpdateQuery(query)),
    navigateToResults: params =>
      dispatch(
        NavigationActions.navigate({ routeName: 'SearchResults', params })
      ),
  };
};

export default connect(
  mapStateToProps,
  mapDispatchToProps
)(SearchStartScreen);

{'fraction_non_alphanumeric': 0.13305613305613306, 'fraction_numerical': 0.0031984647369262755, 'mean_word_length': 2.6831566548881036, 'pattern_counts': {'":': 0, '<': 15, '<?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': '4429753', 'n_tokens_mistral': 1781, 'n_tokens_neox': 1776, 'n_words': 362}