<commit_before>/* @flow */

import React, { Component, PropTypes } from 'react';
import ReactNative from 'react-native';
import shallowEqual from 'shallowequal';
import ImageChooser from 'react-native-image-chooser';
import Colors from '../../Colors';
import Icon from './Icon';
import GrowingTextInput from './GrowingTextInput';
import TouchFeedback from './TouchFeedback';
import ChatSuggestionsContainer from '../containers/ChatSuggestionsContainer';
import ImageUploadContainer from '../containers/ImageUploadContainer';
import ImageUploadChat from './ImageUploadChat';

const {
	StyleSheet,
	View,
	PixelRatio
} = ReactNative;

const styles = StyleSheet.create({
	container: {
		flexDirection: 'row',
		alignItems: 'stretch',
		backgroundColor: Colors.white,
		borderColor: Colors.underlay,
		borderTopWidth: 1 / PixelRatio.get(),
		elevation: 4
	},
	inputContainer: {
		flex: 1,
		paddingHorizontal: 16,
	},
	input: {
		paddingVertical: 8,
		margin: 0,
		backgroundColor: 'transparent',
		color: Colors.black,
	},
	iconContainer: {
		alignItems: 'center',
		justifyContent: 'center'
	},
	icon: {
		color: Colors.fadedBlack,
		margin: 17
	}
});

type Props = {
	room: string;
	thread: string;
	user: string;
	sendMessage: Function;
}

type State = {
	text: string;
	query: string;
	photo: ?{
		uri: string;
		size: number;
		name: string;
		height: number;
		width: number;
	};
}

export default class ChatInput extends Component<void, Props, State> {
	static propTypes = {
		room: PropTypes.string.isRequired,
		thread: PropTypes.string.isRequired,
		user: PropTypes.string.isRequired,
		sendMessage: PropTypes.func.isRequired
	};

	state: State = {
		text: '',
		query: '',
		photo: null,
	};

	shouldComponentUpdate(nextProps: Props, nextState: State): boolean {
		return !shallowEqual(this.props, nextProps) || !shallowEqual(this.state, nextState);
	}

	setQuotedText: Function = (text) => {
		this._computeAndSetText({
			replyTo: text.from,
			quotedText: text.text
		});
	};

	setReplyTo: Function = (text) => {
		this._computeAndSetText({
			replyTo: text.from
		});
	};<commit_msg>Fix quote and reply<commit_after>/* @flow */

import React, { Component, PropTypes } from 'react';
import ReactNative from 'react-native';
import shallowEqual from 'shallowequal';
import ImageChooser from 'react-native-image-chooser';
import Colors from '../../Colors';
import Icon from './Icon';
import GrowingTextInput from './GrowingTextInput';
import TouchFeedback from './TouchFeedback';
import ChatSuggestionsContainer from '../containers/ChatSuggestionsContainer';
import ImageUploadContainer from '../containers/ImageUploadContainer';
import ImageUploadChat from './ImageUploadChat';

const {
	StyleSheet,
	View,
	PixelRatio
} = ReactNative;

const styles = StyleSheet.create({
	container: {
		flexDirection: 'row',
		alignItems: 'stretch',
		backgroundColor: Colors.white,
		borderColor: Colors.underlay,
		borderTopWidth: 1 / PixelRatio.get(),
		elevation: 4
	},
	inputContainer: {
		flex: 1,
		paddingHorizontal: 16,
	},
	input: {
		paddingVertical: 8,
		margin: 0,
		backgroundColor: 'transparent',
		color: Colors.black,
	},
	iconContainer: {
		alignItems: 'center',
		justifyContent: 'center'
	},
	icon: {
		color: Colors.fadedBlack,
		margin: 17
	}
});

type Props = {
	room: string;
	thread: string;
	user: string;
	sendMessage: Function;
}

type State = {
	text: string;
	query: string;
	photo: ?{
		uri: string;
		size: number;
		name: string;
		height: number;
		width: number;
	};
}

export default class ChatInput extends Component<void, Props, State> {
	static propTypes = {
		room: PropTypes.string.isRequired,
		thread: PropTypes.string.isRequired,
		user: PropTypes.string.isRequired,
		sendMessage: PropTypes.func.isRequired
	};

	state: State = {
		text: '',
		query: '',
		photo: null,
	};

	shouldComponentUpdate(nextProps: Props, nextState: State): boolean {
		return !shallowEqual(this.props, nextProps) || !shallowEqual(this.state, nextState);
	}

	setQuotedText: Function = (text) => {
		this._computeAndSetText({
			replyTo: text.creator,
			quotedText: text.body
		});
	};

	setReplyTo: Function = (text) => {
		this._computeAndSetText({
			replyTo: text.creator
		});
	};
{'fraction_non_alphanumeric': 0.13326987148976677, 'fraction_numerical': 0.004283674440742504, 'mean_word_length': 4.458441558441558, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '2348288', 'n_tokens_mistral': 1476, 'n_tokens_neox': 1373, 'n_words': 341}