fix: Button and IconButton TouchableRipple borderRadius #4278
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Resolve issue #4266
Description
Removes the
borderRadius
from theIconButton
innerTouchableRipple
.Using
overflow: hidden
is enough for the inner views to fit the parent view, even taking care of the parent viewborderRadius
.After the changes, we can even set custom border radius for each corner of
IconButton
and theTouchableRipple
will fill the button properlyShot.2024-01-15.at.20.28.01.mp4
Updates the
Button
innerTouchableRipple
props to make the ripple fill theButton
surface.The
overflow: hidden
trick could not be applied toButton
as itsSurface
can be elevated, and when usingoverflow: hidden
the elevation shadow will not be displayed correctly.Adds
contentStyle
prop toIconButton
, similar to the one inButton
Previously there was no way to customize the
IconButton
padding, as if we set it to thestyle
prop, it would cause the innerTouchableRipple
to not fill theIconButton
. Now,contentStyle
allows doing so by setting the styles to the innerTouchableRipple
view.Test plan
Run
yarn example web
to run the example project and view the updated examples forButton
andIconButton