2021-10-01 18:12:19 +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';
|
2022-03-29 18:53:27 +00:00
|
|
|
import { useTheme } from '../../../theme';
|
2021-10-01 18:12:19 +00:00
|
|
|
|
|
|
|
interface IPasscodeButton {
|
2022-01-24 20:12:25 +00:00
|
|
|
text?: string;
|
|
|
|
icon?: string;
|
|
|
|
disabled?: boolean;
|
|
|
|
onPress?: Function;
|
2021-10-01 18:12:19 +00:00
|
|
|
}
|
|
|
|
|
2022-03-29 18:53:27 +00:00
|
|
|
const Button = React.memo(({ text, disabled, onPress, icon }: IPasscodeButton) => {
|
|
|
|
const { theme } = useTheme();
|
|
|
|
|
2022-01-24 20:12:25 +00:00
|
|
|
const press = () => onPress && onPress(text);
|
2021-10-01 18:12:19 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<Touch
|
|
|
|
style={[styles.buttonView, { backgroundColor: 'transparent' }]}
|
2022-01-24 20:12:25 +00:00
|
|
|
underlayColor={themes[theme].passcodeButtonActive}
|
|
|
|
rippleColor={themes[theme].passcodeButtonActive}
|
2021-10-01 18:12:19 +00:00
|
|
|
enabled={!disabled}
|
|
|
|
theme={theme}
|
|
|
|
onPress={press}>
|
|
|
|
{icon ? (
|
2022-01-24 20:12:25 +00:00
|
|
|
<CustomIcon name={icon} size={36} color={themes[theme].passcodePrimary} />
|
2021-10-01 18:12:19 +00:00
|
|
|
) : (
|
2022-01-24 20:12:25 +00:00
|
|
|
<Text style={[styles.buttonText, { color: themes[theme].passcodePrimary }]}>{text}</Text>
|
2021-10-01 18:12:19 +00:00
|
|
|
)}
|
|
|
|
</Touch>
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
export default Button;
|