BlueWallet/components/HeaderRightButton.tsx

44 lines
1.0 KiB
TypeScript
Raw Normal View History

2024-05-11 00:47:22 +02:00
import React from 'react';
2024-05-20 11:54:13 +02:00
import { StyleSheet, Text, TouchableOpacity } from 'react-native';
2024-05-05 02:14:46 +02:00
import { useTheme } from './themes';
interface HeaderRightButtonProps {
2024-05-11 00:47:22 +02:00
disabled?: boolean;
2024-05-05 02:14:46 +02:00
onPress?: () => void;
title: string;
2024-05-05 07:03:39 +02:00
testID?: string;
2024-05-05 02:14:46 +02:00
}
2024-05-11 00:47:22 +02:00
const HeaderRightButton: React.FC<HeaderRightButtonProps> = ({ disabled = true, onPress, title, testID }) => {
2024-05-05 02:14:46 +02:00
const { colors } = useTheme();
2024-05-27 00:10:38 +02:00
const opacity = disabled ? 0.5 : 1;
2024-05-05 02:14:46 +02:00
return (
<TouchableOpacity
accessibilityRole="button"
disabled={disabled}
2024-05-27 00:10:38 +02:00
style={[styles.save, { backgroundColor: colors.lightButton }, { opacity }]}
2024-05-05 02:14:46 +02:00
onPress={onPress}
2024-05-05 07:03:39 +02:00
testID={testID}
2024-05-05 02:14:46 +02:00
>
<Text style={[styles.saveText, { color: colors.buttonTextColor }]}>{title}</Text>
</TouchableOpacity>
);
};
const styles = StyleSheet.create({
save: {
alignItems: 'center',
justifyContent: 'center',
width: 80,
borderRadius: 8,
height: 34,
},
saveText: {
fontSize: 15,
fontWeight: '600',
},
});
2024-05-11 00:47:22 +02:00
export default HeaderRightButton;