2019-05-27 16:19:39 +00:00
|
|
|
import React from 'react';
|
|
|
|
import { BorderlessButton } from 'react-native-gesture-handler';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
|
2019-12-04 16:39:53 +00:00
|
|
|
import { themes } from '../../../constants/colors';
|
2019-05-27 16:19:39 +00:00
|
|
|
import { CustomIcon } from '../../../lib/Icons';
|
|
|
|
import styles from '../styles';
|
|
|
|
import I18n from '../../../i18n';
|
|
|
|
|
|
|
|
const BaseButton = React.memo(({
|
2019-12-04 16:39:53 +00:00
|
|
|
onPress, testID, accessibilityLabel, icon, theme
|
2019-05-27 16:19:39 +00:00
|
|
|
}) => (
|
|
|
|
<BorderlessButton
|
|
|
|
onPress={onPress}
|
|
|
|
style={styles.actionButton}
|
|
|
|
testID={testID}
|
|
|
|
accessibilityLabel={I18n.t(accessibilityLabel)}
|
|
|
|
accessibilityTraits='button'
|
|
|
|
>
|
2019-12-04 16:39:53 +00:00
|
|
|
<CustomIcon name={icon} size={23} color={themes[theme].tintColor} />
|
2019-05-27 16:19:39 +00:00
|
|
|
</BorderlessButton>
|
|
|
|
));
|
|
|
|
|
|
|
|
BaseButton.propTypes = {
|
2019-12-04 16:39:53 +00:00
|
|
|
theme: PropTypes.string,
|
2019-05-27 16:19:39 +00:00
|
|
|
onPress: PropTypes.func.isRequired,
|
|
|
|
testID: PropTypes.string.isRequired,
|
|
|
|
accessibilityLabel: PropTypes.string.isRequired,
|
|
|
|
icon: PropTypes.string.isRequired
|
|
|
|
};
|
|
|
|
|
|
|
|
export default BaseButton;
|