2021-09-13 20:41:05 +00:00
|
|
|
import React from 'react';
|
|
|
|
import { Text } from 'react-native';
|
|
|
|
|
|
|
|
import styles from './styles';
|
|
|
|
import { themes } from '../../../constants/colors';
|
|
|
|
import Touch from '../../../utils/touch';
|
|
|
|
import { CustomIcon } from '../../../lib/Icons';
|
|
|
|
|
|
|
|
interface IPasscodeButton {
|
2022-01-12 12:54:04 +00:00
|
|
|
text?: string;
|
|
|
|
icon?: string;
|
2021-09-13 20:41:05 +00:00
|
|
|
theme: string;
|
2022-01-12 12:54:04 +00:00
|
|
|
disabled?: boolean;
|
|
|
|
onPress?: Function;
|
2021-09-13 20:41:05 +00:00
|
|
|
}
|
|
|
|
|
2022-01-12 12:54:04 +00:00
|
|
|
const Button = React.memo(({ text, disabled, theme, onPress, icon }: IPasscodeButton) => {
|
|
|
|
const press = () => onPress && onPress(text);
|
2021-09-13 20:41:05 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<Touch
|
|
|
|
style={[styles.buttonView, { backgroundColor: 'transparent' }]}
|
2022-01-12 12:54:04 +00:00
|
|
|
underlayColor={themes[theme].passcodeButtonActive}
|
|
|
|
rippleColor={themes[theme].passcodeButtonActive}
|
2021-09-13 20:41:05 +00:00
|
|
|
enabled={!disabled}
|
|
|
|
theme={theme}
|
|
|
|
onPress={press}>
|
|
|
|
{icon ? (
|
2022-01-12 12:54:04 +00:00
|
|
|
<CustomIcon name={icon} size={36} color={themes[theme].passcodePrimary} />
|
2021-09-13 20:41:05 +00:00
|
|
|
) : (
|
2022-01-12 12:54:04 +00:00
|
|
|
<Text style={[styles.buttonText, { color: themes[theme].passcodePrimary }]}>{text}</Text>
|
2021-09-13 20:41:05 +00:00
|
|
|
)}
|
|
|
|
</Touch>
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
export default Button;
|