Skip to content

fix(touchable-ripple): paint the web hover on top of the style background - #5242

Open
jacekAtCK wants to merge 6 commits into
callstack:mainfrom
jacekAtCK:fix/ripple-hover-over-background
Open

jacekAtCK wants to merge 6 commits into
callstack:mainfrom
jacekAtCK:fix/ripple-hover-over-background

Conversation

@jacekAtCK

@jacekAtCK jacekAtCK commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

This is a followup to: #5224 (comment)

On web, TouchableRipple paints hover as its own backgroundColor, and a backgroundColor in style ovverides it. So a selected Drawer.Item or a selected List.Item from #5224, shows no hover effect.

Hover is now a linear-gradient background image after style. It paints on top of the background color and keeps the border radius. Hover no longer fades in as it cannot animate background image.

Related issue

Follow-up to #5224 (comment)

Screenshots / Videos

hover-after-drawer hover-before-drawer

Test plan

In the web example:

  1. Hover a selected Drawer.Item. The hover layer shows on top of the selected color, with rounded corners.
  2. Hover an unselected row and a Button. They look as before.

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Found potential problems with the pull request:

  • The description is too long. Please keep it under 1000 characters.

@jacekAtCK

Copy link
Copy Markdown
Collaborator Author

/review

@apex-sentinel-staging

This comment has been minimized.

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 3 new findings on 58d3075. The verdict and the full list are in the summary comment.

Comment thread src/components/TouchableRipple/utils.ts Resolved
@jacekAtCK

Copy link
Copy Markdown
Collaborator Author

/review

@apex-sentinel-staging

This comment has been minimized.

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 3 new findings and 1 moved to a new line on 25e3177. The verdict and the full list are in the summary comment.

Comment thread src/components/TouchableRipple/utils.ts Resolved
@jacekAtCK

Copy link
Copy Markdown
Collaborator Author

/review

@apex-sentinel-staging

This comment has been minimized.

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 1 finding moved to a new line on 69a6fe0. The verdict and the full list are in the summary comment.

@apex-sentinel-staging

This comment has been minimized.

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 1 finding moved to a new line on 69a6fe0. The verdict and the full list are in the summary comment.

Comment thread src/components/TouchableRipple/utils.ts Resolved
@jacekAtCK jacekAtCK self-assigned this Nov 19, 2026
@apex-sentinel-staging

Copy link
Copy Markdown

Apex Sentinel · ✅ Approve · review of 40b9845

Since the review of 69a6fe0: 1 new · 0 still open · 1 no longer raised

1 finding(s): 1 minor.

🟡 Minor (1)

Where Finding
src/components/TouchableRipple/TouchableRipple.tsx:363 🆕 The 150ms hover fade is gone: transition still names background-color, hover is now a background image
Not in the reviewers' prompt (1 file)
  • src/components/__tests__/__snapshots__/TouchableRippleWeb.test.tsx.snap: generated or a lockfile, so its lines were left out

Reviewed with this repository's own Sentinel configuration (9029fbcd5df0).

💬 Talking to Sentinel

In a finding's thread, reply with:

Command What it does
@apex-sentinel-staging note <context> Adds context; Sentinel re-checks the cited code
@apex-sentinel-staging pivot <why> Says the finding is wrong; Sentinel re-checks the cited code
@apex-sentinel-staging like Marks the finding as useful
@apex-sentinel-staging dislike <why> Marks it as not useful, so it is not raised again

On this conversation, comment @apex-sentinel-staging review to run a full review once again.

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 1 finding moved to a new line on 40b9845. The verdict and the full list are in the summary comment.

!isInteractive && styles.disabled,
typeof style === 'function' ? style(state) : style,
// After `style`, so a background set there does not hide the hover.
state.hovered && isInteractive && getHoverStyle(hoverColor),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🆕 🟡 Minor · The 150ms hover fade is gone: transition still names background-color, hover is now a background image

On web, hovering an interactive TouchableRipple pops the state layer in and out at full opacity instead of easing over 150ms. styles.touchable still declares transition: '150ms background-color', but hover moved to backgroundImage which CSS cannot transition. The migration note added in this PR documents only the backgroundColor/backgroundImage swap, not the fade loss, so consumers upgrading will read it as a no-visual-change fix.

Suggested change

Either remove transition: '150ms background-color' from styles.touchable or re-implement the fade as an opacity-transitioned absolutely-positioned child View, and add a line to the TouchableRipple section of the migration guide that hover no longer fades in on web.

Details

Also raised here

Also raised at this location by persona javascript: Hover no longer fades: the 150ms transition in styles.touchable no longer covers it — On web, moving the mouse onto a row now snaps the hover layer on and off instantly, where the previous backgroundColor hover faded over 150ms. Cause: styles.touchable still declares transition: '150ms background-color' (TouchableRipple.tsx:413), but the hover layer is now a backgroundImage gradient (utils.ts:81) and browsers do not interpolate gradients, so that transition applies to nothing the component animates any more — it only still affects a consumer's own backgroundColor change. If the instant pop is acceptable, the now-dead background-color transition should go (or say why it stays); if the fade is wanted, the layer needs to be an overlay child whose opacity transitions rather than a background image. The migration note at docs/6.x/docs/guides/migration.md:942 documents the paint order but not this loss of the fade, which is what a consumer will notice on every hover.

persona: senior-developer, javascript, react-native-paper

Useful? Reply @apex-sentinel-staging like, or @apex-sentinel-staging dislike <why> if it is not.

Reply @apex-sentinel-staging note ... to add context, or @apex-sentinel-staging pivot ... if it is wrong — I will re-check the cited code.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant