Rocket.Chat.ReactNative/app/containers/Passcode/Base/Button.js

44 lines
986 B
JavaScript

import React from 'react';
import { Text } from 'react-native';
import PropTypes from 'prop-types';
import styles from './styles';
import { themes } from '../../../constants/colors';
import Touch from '../../../utils/touch';
import I18n from '../../../i18n';
const Button = ({
text, disabled, theme, onPress, del
}) => (
<Touch
style={[styles.buttonCircle, { backgroundColor: themes[theme].backgroundColor, borderColor: themes[theme].borderColor }]}
disabled={disabled}
theme={theme}
onPress={() => onPress && onPress(text)}
>
{
del
? (
<Text style={[styles.deleteText, { color: themes[theme].titleText }]}>
{I18n.t('Passcode_del')}
</Text>
)
: (
<Text style={[styles.text, { color: themes[theme].titleText }]}>
{text}
</Text>
)
}
</Touch>
);
Button.propTypes = {
text: PropTypes.string,
theme: PropTypes.string,
disabled: PropTypes.bool,
del: PropTypes.bool,
onPress: PropTypes.func
};
export default Button;