2019-05-27 16:19:39 +00:00
|
|
|
import React from 'react';
|
|
|
|
import { BorderlessButton } from 'react-native-gesture-handler';
|
|
|
|
|
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';
|
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
interface IBaseButton {
|
|
|
|
theme: string;
|
|
|
|
onPress(): void;
|
|
|
|
testID: string;
|
|
|
|
accessibilityLabel: string;
|
|
|
|
icon: string;
|
|
|
|
color: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
const BaseButton = React.memo(({ onPress, testID, accessibilityLabel, icon, theme, color }: Partial<IBaseButton>) => (
|
2019-05-27 16:19:39 +00:00
|
|
|
<BorderlessButton
|
|
|
|
onPress={onPress}
|
|
|
|
style={styles.actionButton}
|
|
|
|
testID={testID}
|
2021-09-13 20:41:05 +00:00
|
|
|
// @ts-ignore
|
2019-05-27 16:19:39 +00:00
|
|
|
accessibilityLabel={I18n.t(accessibilityLabel)}
|
2021-09-13 20:41:05 +00:00
|
|
|
accessibilityTraits='button'>
|
|
|
|
<CustomIcon name={icon} size={24} color={color ?? themes[theme!].auxiliaryTintColor} />
|
2019-05-27 16:19:39 +00:00
|
|
|
</BorderlessButton>
|
|
|
|
));
|
|
|
|
|
|
|
|
export default BaseButton;
|