// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import React, {PureComponent} from 'react'; import PropTypes from 'prop-types'; import {Text, TouchableHighlight, TouchableOpacity, View} from 'react-native'; import IonIcon from 'react-native-vector-icons/Ionicons'; import {changeOpacity, makeStyleSheetFromTheme} from 'app/utils/theme'; export const RECENT_LABEL_HEIGHT = 42; export default class RecentItem extends PureComponent { static propTypes = { item: PropTypes.object.isRequired, removeSearchTerms: PropTypes.func.isRequired, setRecentValue: PropTypes.func.isRequired, theme: PropTypes.object.isRequired, }; handlePress = () => { const {item, setRecentValue} = this.props; setRecentValue(item); }; handleRemove = () => { const {item, removeSearchTerms} = this.props; removeSearchTerms(item); }; render() { const {item, theme} = this.props; const style = getStyleFromTheme(theme); return ( {item.terms} ); } } const getStyleFromTheme = makeStyleSheetFromTheme((theme) => { return { recentItemContainer: { alignItems: 'center', flex: 1, flexDirection: 'row', height: RECENT_LABEL_HEIGHT, }, recentItemLabel: { color: theme.centerChannelColor, fontSize: 14, height: 20, flex: 1, paddingHorizontal: 16, }, recentRemove: { alignItems: 'center', height: RECENT_LABEL_HEIGHT, justifyContent: 'center', width: 50, }, }; });