vn-verdnaturachat/app/views/SidebarView/SidebarItem.js

40 lines
846 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';
2019-03-29 19:36:07 +00:00
import { COLOR_TEXT } from '../../constants/colors';
2019-03-12 16:23:06 +00:00
const Item = React.memo(({
left, text, onPress, testID, current
}) => (
<RectButton
key={testID}
testID={testID}
onPress={onPress}
2019-03-29 19:36:07 +00:00
underlayColor={COLOR_TEXT}
2019-03-12 16:23:06 +00:00
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;