Fix active button color on Android

This commit is contained in:
Lei Nelissen
2021-04-03 15:19:38 +02:00
parent d422c1ff1e
commit 1edeb00631

View File

@@ -13,21 +13,14 @@ interface ButtonProps extends PressableProps {
style?: ViewProps['style']; style?: ViewProps['style'];
} }
interface PressableStyleProps {
active: boolean;
}
const BaseButton = styled.Pressable<PressableStyleProps>` const BaseButton = styled.Pressable`
padding: 16px; padding: 16px;
border-radius: 8px; border-radius: 8px;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
flex-grow: 1; flex-grow: 1;
${props => props.active && css`
background-color: ${THEME_COLOR};
`}
`; `;
const ButtonText = styled.Text<{ active?: boolean }>` const ButtonText = styled.Text<{ active?: boolean }>`
@@ -51,8 +44,10 @@ export default function Button(props: ButtonProps) {
{...rest} {...rest}
onPressIn={handlePressIn} onPressIn={handlePressIn}
onPressOut={handlePressOut} onPressOut={handlePressOut}
active={isPressed} style={[
style={[ defaultStyles.button, props.style ]} props.style,
{ backgroundColor: isPressed ? THEME_COLOR : defaultStyles.button.backgroundColor }
]}
> >
{Icon && {Icon &&
<Icon <Icon