<commit_before>import React, { PropTypes } from 'react';
import {
	View,
	StyleSheet,
	Dimensions,
	Text,
	ListView,
	TouchableOpacity
} from 'react-native';

import ElevatedView from 'react-native-elevated-view';
import Icon from 'react-native-vector-icons/FontAwesome';
// import MaterialIcon from 'react-native-vector-icons/MaterialCommunityIcons'; // Can't use until RNVI 4.0
import MaterialIcon from 'react-native-vector-icons/MaterialIcons';
import { getPRM, getMaxCardWidth } from '../../util/general';

const PRM = getPRM();
const deviceHeight = Dimensions.get('window').height;
const deviceWidth = Dimensions.get('window').width;

const historyDataSource = new ListView.DataSource({ rowHasChanged: (r1, r2) => r1 !== r2 });
const suggestions = [
	{
		name: 'Parking',
		icon: 'local-parking',
	},
	{
		name: 'Hydration',
		icon: 'local-drink',
	},
	{
		name: 'Mail',
		icon: 'local-post-office',
	},
	{
		name: 'ATM',
		icon: 'local-atm',
	},
];

const SearchSuggest = ({ onPress }) => (
	<ElevatedView
		style={styles.card_main}
		elevation={2}
	>
		<View style={styles.list_container}>
			<SearchHistoryList
				historyData={historyDataSource.cloneWithRows(suggestions)}
				onPress={onPress}
			/>
		</View>
	</ElevatedView>
);

const SearchHistoryList = ({ historyData, onPress }) => (
	<ListView
		showsVerticalScrollIndicator={false}
		showsHorizontalScrollIndicator={false}
		dataSource={historyData}
		horizontal={true}
		renderRow={
			(row, sectionID, rowID) =>
				<SearchHistoryItem
					data={row}
					onPress={onPress}
				/>
		}
	/>
);

// local-dining
// local-drink
// local-parking
// local-grocery-store

const SearchHistoryItem = ({ data, onPress }) => (
	<TouchableOpacity
		underlayColor={'rgba(200,200,200,.1)'}
		onPress={() => {
			onPress(data.name);
		}}
	>
		<View style={styles.list_row}>
			<ElevatedView
				style={styles.icon_container}
				elevation={3}
			>
				<MaterialIcon
					name={data.icon}
					size={Math.round(24 * PRM)}
					color={'white'}
				/>
			</ElevatedView>
		</View>
	</TouchableOpacity>
);

/*
<View
				style={styles.text_container}
			>
				<Text>{data.name}</Text>
			</View>*/

const styles = StyleSheet.create({
	list_container: { width: getMaxCardWidth(), paddingTop: 8, paddingBottom: 8, height: Math.round(deviceWidth / 4) },
	card_main: { top: Math.round(44 * getPRM()) + 6, backgroundColor: '#FFFFFF', margin: 6, alignItems: 'center', justifyContent: 'center',  },
	list_row: { flex: 1, alignItems: 'center', flexDirection: 'column', paddingVertical: 14, width: Math.round((deviceWidth - 12) / 4), },
	icon_container: { justifyContent: 'center', alignItems: 'center', width: 50, height: 50, borderRadius: 50 / 2, backgroundColor: '#db3236' },<commit_msg>Added name to search suggestion icons<commit_after>import React, { PropTypes } from 'react';
import {
	View,
	StyleSheet,
	Dimensions,
	Text,
	ListView,
	TouchableOpacity
} from 'react-native';

import ElevatedView from 'react-native-elevated-view';
import Icon from 'react-native-vector-icons/FontAwesome';
// import MaterialIcon from 'react-native-vector-icons/MaterialCommunityIcons'; // Can't use until RNVI 4.0
import MaterialIcon from 'react-native-vector-icons/MaterialIcons';
import { getPRM, getMaxCardWidth } from '../../util/general';

const PRM = getPRM();
const deviceHeight = Dimensions.get('window').height;
const deviceWidth = Dimensions.get('window').width;

const historyDataSource = new ListView.DataSource({ rowHasChanged: (r1, r2) => r1 !== r2 });
const suggestions = [
	{
		name: 'Parking',
		icon: 'local-parking',
	},
	{
		name: 'Hydration',
		icon: 'local-drink',
	},
	{
		name: 'Mail',
		icon: 'local-post-office',
	},
	{
		name: 'ATM',
		icon: 'local-atm',
	},
];

const SearchSuggest = ({ onPress }) => (
	<ElevatedView
		style={styles.card_main}
		elevation={2}
	>
		<View style={styles.list_container}>
			<SearchHistoryList
				historyData={historyDataSource.cloneWithRows(suggestions)}
				onPress={onPress}
			/>
		</View>
	</ElevatedView>
);

const SearchHistoryList = ({ historyData, onPress }) => (
	<ListView
		showsVerticalScrollIndicator={false}
		showsHorizontalScrollIndicator={false}
		dataSource={historyData}
		horizontal={true}
		renderRow={
			(row, sectionID, rowID) =>
				<SearchHistoryItem
					data={row}
					onPress={onPress}
				/>
		}
	/>
);

// local-dining
// local-drink
// local-parking
// local-grocery-store

const SearchHistoryItem = ({ data, onPress }) => (
	<TouchableOpacity
		underlayColor={'rgba(200,200,200,.1)'}
		onPress={() => {
			onPress(data.name);
		}}
	>
		<View style={styles.list_row}>
			<ElevatedView
				style={styles.icon_container}
				elevation={3}
			>
				<MaterialIcon
					name={data.icon}
					size={Math.round(24 * PRM)}
					color={'white'}
				/>
			</ElevatedView>
			<Text style={styles.icon_label}>
				{data.name}
			</Text>
		</View>
	</TouchableOpacity>
);

/*
<View
				style={styles.text_container}
			>
				<Text>{data.name}</Text>
			</View>*/

const styles = StyleSheet.create({
	list_container: { width: getMaxCardWidth(), paddingTop: 8, paddingBottom: 8, height: Math.round(deviceWidth / 4) },
	card_main: { top: Math.round(44 * getPRM()) + 6, backgroundColor: '#FFFFFF', margin: 6, alignItems: 'center', justifyContent: 'center',  },
	list_row: { flex: 1, alignItems: 'center', flexDirection: 'column', paddingVertical: 14, width: Math.round((deviceWidth - 12) / 4), },
	icon_container: { justifyContent: 'center', alignItems: 'center', width: 50, height: 50, borderRadius: 50 / 2, backgroundColor: '#db3236' },
	icon_label: { margin: 2, color: '#9E9E9E' },
{'fraction_non_alphanumeric': 0.1659216878240658, 'fraction_numerical': 0.016449132844627214, 'mean_word_length': 4.213420316868593, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 53, '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': '5546589', 'n_tokens_mistral': 2191, 'n_tokens_neox': 1929, 'n_words': 388}