Merge pull request #6400 from BlueWallet/buttontext

FIX: Some screens had Button styling was broken
This commit is contained in:
GLaDOS 2024-04-13 06:25:42 +00:00 committed by GitHub
commit d7f3579aee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 12 deletions

View file

@ -41,17 +41,17 @@ export const Button = forwardRef<TouchableOpacity, ButtonProps>((props, ref) =>
}; };
const buttonView = ( const buttonView = (
<View style={[buttonStyle, props.style, styles.content]}> <>
{props.icon && <Icon name={props.icon.name} type={props.icon.type} color={props.icon.color} />} {props.icon && <Icon name={props.icon.name} type={props.icon.type} color={props.icon.color} />}
{props.title && <Text style={textStyle}>{props.title}</Text>} {props.title && <Text style={textStyle}>{props.title}</Text>}
</View> </>
); );
return props.onPress ? ( return props.onPress ? (
<TouchableOpacity <TouchableOpacity
ref={ref} ref={ref}
testID={props.testID} testID={props.testID}
style={[buttonStyle, props.style]} style={[buttonStyle, props.style, styles.content]}
accessibilityRole="button" accessibilityRole="button"
onPress={props.onPress} onPress={props.onPress}
disabled={props.disabled} disabled={props.disabled}
@ -59,7 +59,7 @@ export const Button = forwardRef<TouchableOpacity, ButtonProps>((props, ref) =>
{buttonView} {buttonView}
</TouchableOpacity> </TouchableOpacity>
) : ( ) : (
buttonView <View style={[buttonStyle, props.style, styles.content]}>{buttonView}</View>
); );
}); });

View file

@ -11,12 +11,7 @@ interface StyledButtonProps {
buttonStyle?: keyof typeof StyledButtonType; buttonStyle?: keyof typeof StyledButtonType;
} }
const StyledButton: FC<StyledButtonProps> = ({ const StyledButton: FC<StyledButtonProps> = ({ onPress, text, disabled = false, buttonStyle = StyledButtonType.default }) => {
onPress,
text,
disabled = false,
buttonStyle = StyledButtonType.default
}) => {
const { colors } = useTheme(); const { colors } = useTheme();
const stylesHook = StyleSheet.create({ const stylesHook = StyleSheet.create({
buttonGrey: { buttonGrey: {
@ -26,8 +21,8 @@ const StyledButton: FC<StyledButtonProps> = ({
color: colors.buttonTextColor, color: colors.buttonTextColor,
}, },
container: { container: {
opacity: disabled ? 0.5 : 1.0 opacity: disabled ? 0.5 : 1.0,
} },
}); });
const textStyles = () => { const textStyles = () => {
if (buttonStyle === StyledButtonType.grey) { if (buttonStyle === StyledButtonType.grey) {