verdnatura-chat/app/views/SidebarView/SidebarItem.js

39 lines
790 B
JavaScript
Raw Normal View History

2019-03-12 16:23:06 +00:00
import React from 'react';
import { View, Text } from 'react-native';
import PropTypes from 'prop-types';
import { RectButton } from 'react-native-gesture-handler';
import styles from './styles';
const Item = React.memo(({
left, text, onPress, testID, current
}) => (
<RectButton
key={testID}
testID={testID}
onPress={onPress}
underlayColor='#292E35'
activeOpacity={0.1}
style={[styles.item, current && styles.itemCurrent]}
>
<View style={styles.itemLeft}>
{left}
</View>
<View style={styles.itemCenter}>
<Text style={styles.itemText}>
{text}
</Text>
</View>
</RectButton>
));
Item.propTypes = {
left: PropTypes.element,
text: PropTypes.string,
current: PropTypes.bool,
onPress: PropTypes.func,
testID: PropTypes.string
};
export default Item;