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

44 lines
986 B
JavaScript
Raw Normal View History

2020-04-23 16:08:50 +00:00
import React from 'react';
2020-04-23 19:37:00 +00:00
import { Text } from 'react-native';
import PropTypes from 'prop-types';
2020-04-23 16:08:50 +00:00
import styles from './styles';
2020-04-23 20:11:17 +00:00
import { themes } from '../../../constants/colors';
import Touch from '../../../utils/touch';
2020-04-24 13:15:07 +00:00
import I18n from '../../../i18n';
2020-04-23 16:08:50 +00:00
2020-04-23 19:37:00 +00:00
const Button = ({
2020-04-24 11:56:55 +00:00
text, disabled, theme, onPress, del
2020-04-23 16:38:27 +00:00
}) => (
2020-04-23 19:37:00 +00:00
<Touch
style={[styles.buttonCircle, { backgroundColor: themes[theme].backgroundColor, borderColor: themes[theme].borderColor }]}
2020-04-23 16:38:27 +00:00
disabled={disabled}
2020-04-23 19:37:00 +00:00
theme={theme}
2020-04-23 16:38:27 +00:00
onPress={() => onPress && onPress(text)}
2020-04-23 16:08:50 +00:00
>
2020-04-24 11:56:55 +00:00
{
del
? (
<Text style={[styles.deleteText, { color: themes[theme].titleText }]}>
2020-04-24 13:15:07 +00:00
{I18n.t('Passcode_del')}
2020-04-24 11:56:55 +00:00
</Text>
)
: (
<Text style={[styles.text, { color: themes[theme].titleText }]}>
{text}
</Text>
)
}
2020-04-23 19:37:00 +00:00
</Touch>
2020-04-23 16:08:50 +00:00
);
2020-04-23 19:37:00 +00:00
Button.propTypes = {
text: PropTypes.string,
theme: PropTypes.string,
disabled: PropTypes.bool,
2020-04-24 11:56:55 +00:00
del: PropTypes.bool,
2020-04-23 19:37:00 +00:00
onPress: PropTypes.func
};
export default Button;