Skip to content

fix(touchable-ripple): fall back to the default ripple for a PlatformColor rippleColor on Android - #5332

Merged
Doberjohn merged 2 commits into
mainfrom
@Doberjohn/ripple-platformcolor
Nov 30, 2026
Merged

Doberjohn merged 2 commits into
mainfrom
@Doberjohn/ripple-platformcolor

Conversation

@Doberjohn

@Doberjohn Doberjohn commented Nov 30, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

On Android with React Native 0.85 or older, a TouchableRipple with a PlatformColor rippleColor or background color (such as a DynamicLightTheme color on Android 12+) red-screens with "Unexpected color given for Ripple color". It now falls back to the default ripple there. React Native 0.86+ takes a PlatformColor ripple (react/react-native#56395), so it's kept.

Related issue

Fixes #5328

Screenshots / Videos

Android 13, React Native 0.88, pressed:

image image

Test plan

Tests cover React Native 0.85 (the example runs 0.88). On Android 12+, press a TouchableRipple and an IconButton with rippleColor={theme.colors.primary} under DynamicLightTheme: the ripple is the primary color.

React Native 0.85 and older throw "Unexpected color given for Ripple color"
from Pressable when android_ripple gets a color that processColor doesn't
turn into a number, such as a PlatformColor from DynamicLightTheme or
DynamicDarkTheme. On those versions TouchableRipple now gives the native
ripple the theme's pressed state layer instead, or no color when that one
can't be used either. React Native 0.86 and later take a PlatformColor
ripple color, so it is passed through unchanged there.

Fixes #5328
@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: 2 new findings on d31aa2d. The verdict and the full list are in the summary comment.

Comment thread src/components/TouchableRipple/utils.ts Resolved
@Doberjohn Doberjohn self-assigned this Nov 30, 2026
A caller's own background={{ color }} skipped the ripple color check, so
a PlatformColor there still threw "Unexpected color given for Ripple
color" on React Native 0.85 and older, also through Button, Chip and the
other components that pass background on. Its color now gets the same
check as rippleColor: when it can be used, the background is passed
through as it is; otherwise it is copied with Paper's default ripple
color, keeping borderless, foreground and radius.
@apex-sentinel-staging

Copy link
Copy Markdown

Apex Sentinel · ✅ Approve · review of 76a856e

Since the review of d31aa2d: 0 new · 0 still open · 2 no longer raised (1 marked fixed)

No open findings.

🔧 1 finding marked fixed in their threads
Finding Fixed by Where
PlatformColor in a caller's own background still red-screens on RN ≤ 0.85 Doberjohn 76a856e · reply

1 finding below minor hidden (user_settings.min_severity).

1 new finding away from what changed since d31aa2d not shown. Comment @apex-sentinel-staging review for a full review.

Reviewed with this repository's own Sentinel configuration (1d9b7f43be12).

💬 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.

@Doberjohn
Doberjohn merged commit fa8fc92 into main Nov 30, 2026
15 checks passed
@Doberjohn
Doberjohn deleted the @Doberjohn/ripple-platformcolor branch November 30, 2026 21:10
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.

TouchableRipple red-screens on Android when rippleColor comes from a dynamic theme

2 participants