Skip to content

fix: Button and IconButton TouchableRipple borderRadius #4278

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Apr 22, 2025
Prev Previous commit
Next Next commit
fix: border radius calculation if set border radius is 0
  • Loading branch information
jahirfiquitiva committed Jun 9, 2024
commit b277bef534b2fd446dae70c359203da416ebac07
8 changes: 5 additions & 3 deletions src/components/Button/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,11 @@ export const getButtonTouchableRippleStyle = (
) as Array<keyof ViewStyleBorderRadiusStyles>
).forEach((key) => {
const value = style[key as keyof ViewStyleBorderRadiusStyles];
if (typeof value !== 'undefined' && typeof value === 'number')
touchableRippleStyle[key as keyof ViewStyleBorderRadiusStyles] =
value - borderWidth;
if (typeof value !== 'undefined' && typeof value === 'number') {
// Only subtract borderWidth if value is greater than 0
const radius = value > 0 ? value - borderWidth : 0;
touchableRippleStyle[key as keyof ViewStyleBorderRadiusStyles] = radius;
}
});
return touchableRippleStyle;
};