mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Fix android_ripple not working with foreground: false in RN 0.82.1 (#54455)
Summary: Fixes https://github.com/facebook/react-native/issues/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: https://github.com/facebook/react-native/pull/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
This commit is contained in:
1 parent
780281acee
commit
ca077c6bf8
1 file changed
+1
-1
+1
-1
@@ -467,7 +467,7 @@ public object BackgroundStyleApplicator {
|
||||
*/
|
||||
@JvmStatic
|
||||
public fun setFeedbackUnderlay(view: View, drawable: Drawable?) {
|
||||
ensureCompositeBackgroundDrawable(view).withNewFeedbackUnderlay(drawable)
|
||||
view.background = ensureCompositeBackgroundDrawable(view).withNewFeedbackUnderlay(drawable)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user