<commit_before>import React from 'react';
import {
	View,
	Text,
	StyleSheet,
	ListView,
	Dimensions,
	TouchableOpacity
} from 'react-native';
import SortableList from 'react-native-sortable-list';
import Icon from 'react-native-vector-icons/FontAwesome';
import { connect } from 'react-redux';

import css from '../../styles/css';


const deviceWidth = Dimensions.get('window').width;
const savedDataSource = new ListView.DataSource({ rowHasChanged: (r1, r2) => r1 !== r2 });

class ShuttleSavedListView extends React.Component {
	componentWillMount() {
		const { savedStops } = this.props;
		const savedObject = {};
		for (let i = 0; i < savedStops.length; ++i) {
			savedObject[i] = savedStops[i];
		}
		this.setState({ savedObject });
	}

	shouldComponentUpdate() {
		return false; // stop list from re-rendering
	}

	render() {
		return (
			<SortableList
				style={[css.main_container, css.scroll_main, css.whitebg]}
				data={this.state.savedObject}
				renderRow={
					({ data, active, disabled }) =>
						<SavedItem
							data={data}
							active={active}
						/>
				}
				onChangeOrder={(nextOrder) => { this._order = nextOrder; }}
				onReleaseRow={(key) => this.props.orderStops(this._order)}
			/>
		);
	}
}

const SavedItem = ({ data, active }) => (
	<TouchableOpacity
		style={styles.list_row}
	>
		<Icon
			name="ellipsis-v"
			size={20}
		/>
		<Text style={{ margin: 7 }}>
			{data.name.trim()}
		</Text>
	</TouchableOpacity>
);

function mapStateToProps(state, props) {
	return {
		savedStops: state.shuttle.savedStops,
	};
}

function mapDispatchtoProps(dispatch) {
	return {
		orderStops: (newOrder) => {
			dispatch({ type: 'ORDER_STOPS', newOrder });
		}
	};
}

const styles = StyleSheet.create({<commit_msg>Update manage stops drag icon to drag-handle<commit_after>import React from 'react';
import {
	View,
	Text,
	StyleSheet,
	ListView,
	Dimensions,
	TouchableOpacity
} from 'react-native';
import SortableList from 'react-native-sortable-list';
import Icon from 'react-native-vector-icons/MaterialIcons';
import { connect } from 'react-redux';

import css from '../../styles/css';


const deviceWidth = Dimensions.get('window').width;
const savedDataSource = new ListView.DataSource({ rowHasChanged: (r1, r2) => r1 !== r2 });

class ShuttleSavedListView extends React.Component {
	componentWillMount() {
		const { savedStops } = this.props;
		const savedObject = {};
		for (let i = 0; i < savedStops.length; ++i) {
			savedObject[i] = savedStops[i];
		}
		this.setState({ savedObject });
	}

	shouldComponentUpdate() {
		return false; // stop list from re-rendering
	}

	render() {
		return (
			<SortableList
				style={[css.main_container, css.scroll_main, css.whitebg]}
				data={this.state.savedObject}
				renderRow={
					({ data, active, disabled }) =>
						<SavedItem
							data={data}
							active={active}
						/>
				}
				onChangeOrder={(nextOrder) => { this._order = nextOrder; }}
				onReleaseRow={(key) => this.props.orderStops(this._order)}
			/>
		);
	}
}

const SavedItem = ({ data, active }) => (
	<TouchableOpacity
		style={styles.list_row}
	>
		<Icon
			name="drag-handle"
			size={20}
		/>
		<Text style={{ margin: 7 }}>
			{data.name.trim()}
		</Text>
	</TouchableOpacity>
);

function mapStateToProps(state, props) {
	return {
		savedStops: state.shuttle.savedStops,
	};
}

function mapDispatchtoProps(dispatch) {
	return {
		orderStops: (newOrder) => {
			dispatch({ type: 'ORDER_STOPS', newOrder });
		}
	};
}

const styles = StyleSheet.create({
{'fraction_non_alphanumeric': 0.15535917901938426, 'fraction_numerical': 0.004561003420752566, 'mean_word_length': 3.7037533512064345, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 29, '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': '399910', 'n_tokens_mistral': 1364, 'n_tokens_neox': 1202, 'n_words': 249}