// Copyright (c) 2017 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. import React from 'react'; import {TouchableHighlight, View} from 'react-native'; import Icon from 'react-native-vector-icons/FontAwesome'; import TextInputWithLocalizedPlaceholder from 'app/components/text_input_with_localized_placeholder'; import {changeOpacity} from 'app/utils/colors'; // import PaperClipIcon from './components/paper_clip_icon.js'; const MAX_CONTENT_HEIGHT = 100; export default class PostTextbox extends React.PureComponent { static propTypes = { currentUserId: React.PropTypes.string.isRequired, teamId: React.PropTypes.string.isRequired, channelId: React.PropTypes.string.isRequired, rootId: React.PropTypes.string, value: React.PropTypes.string.isRequired, onChangeText: React.PropTypes.func.isRequired, theme: React.PropTypes.object.isRequired, actions: React.PropTypes.shape({ createPost: React.PropTypes.func.isRequired }).isRequired }; static defaultProps = { rootId: '' }; constructor(props) { super(props); this.state = { contentHeight: 0 }; } blur = () => { this.refs.input.getWrappedInstance().blur(); } handleContentSizeChange = (e) => { this.setState({ contentHeight: e.nativeEvent.contentSize.height }); } sendMessage = () => { if (this.props.value.trim().length === 0) { return; } const post = { user_id: this.props.currentUserId, channel_id: this.props.channelId, root_id: this.props.rootId, parent_id: this.props.rootId, message: this.props.value }; this.props.actions.createPost(this.props.teamId, post); this.props.onChangeText(''); } render() { const theme = this.props.theme; let placeholder; if (this.props.rootId) { placeholder = {id: 'create_comment.addComment', defaultMessage: 'Add a comment...'}; } else { placeholder = {id: 'create_post.write', defaultMessage: 'Write a message...'}; } return ( {/* */} ); } }