Skip to content

Button and IconButton TouchableRipple borderRadius is calculated from the icon size and not the button borderRadius #4266

@jahirfiquitiva

Description

@jahirfiquitiva

Current behaviour

The IconButton component TouchableRipple borderRadius is calculated based on the icon size and the button padding.

const buttonSize = isV3 ? size + 2 * PADDING : size * 1.5;
const {
borderWidth = isV3 && mode === 'outlined' && !selected ? 1 : 0,
borderRadius = buttonSize / 2,
} = (StyleSheet.flatten(style) || {}) as ViewStyle;

style={[styles.touchable, { borderRadius }]}

Expected behaviour

The borderRadius for the TouchableRipple should match the borderRadius set for the button in styles and fill the button surface

How to reproduce?

https://snack.expo.dev/@jahirfiquitiva/rnp-iconbutton-ripple

Preview

Shot 2024-01-11 at 12 10 10@2x

Alternative solution

Add a prop to customize the TouchableRipple borderRadius.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions