Skip to content

Commit ca077c6

Browse files
ish1416meta-codesync[bot]
authored andcommitted
Fix android_ripple not working with foreground: false in RN 0.82.1 (#54455)
Summary: Fixes #54372 #54298 The `android_ripple` prop on `Pressable` components stopped working in React Native 0.82.1 when `foreground: false` (the default value). This regression was introduced by the new background drawable system. **Root Cause:** The `setFeedbackUnderlay` method in `BackgroundStyleApplicator.kt` was creating a new `CompositeBackgroundDrawable` with the ripple effect but not assigning it back to the view's background, causing the ripple to be invisible. **Solution:** Modified the method to properly assign the new composite drawable containing the ripple effect to `view.background`. ## Changelog: <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: [ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [ANDROID] [FIXED] - Fix android_ripple not working with foreground: false in Pressable components Pull Request resolved: #54455 Test Plan: **Before the fix:** Create a Pressable with android_ripple and foreground: false (default) - no ripple effect appears when pressed. **After the fix:** The ripple effect works correctly. Test case: ```jsx <Pressable android_ripple={{ color: 'red', borderless: false }} onPress={() => console.log('Pressed!')} > <Text>Press Me</Text> </Pressable> Reviewed By: jorge-cab Differential Revision: D86671603 Pulled By: joevilches fbshipit-source-id: 71cef114e903a9f807a52a9f3902b85d44bf58b3
1 parent 780281a commit ca077c6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/BackgroundStyleApplicator.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ public object BackgroundStyleApplicator {
467467
*/
468468
@JvmStatic
469469
public fun setFeedbackUnderlay(view: View, drawable: Drawable?) {
470-
ensureCompositeBackgroundDrawable(view).withNewFeedbackUnderlay(drawable)
470+
view.background = ensureCompositeBackgroundDrawable(view).withNewFeedbackUnderlay(drawable)
471471
}
472472

473473
/**

0 commit comments

Comments
 (0)