Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android: Fix switch ripple color #30685

Closed
wants to merge 2 commits into from

Conversation

rnike
Copy link
Contributor

@rnike rnike commented Jan 4, 2021

Summary

fix #22370

Use RippleDrawable to change ripple color.
According to the document, RippleDrawable is added in API 21, so warped the code in the if statement for version checking.

Changelog

[Android] [Fixed] - Fix wrong ripple color on Switch component

Test Plan

  1. Create an empty app with react-native 0.63.4, copy&paste the App.js from issue Wrong ripple color in Switch component #22370
  2. Apply the code for fixing to node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/views/switchview/ReactSwitch.java
  3. Configure the project to let it Build from ReactAndroid
  4. Check if ripple color has changed correctly
  5. Use different color on each state and check if it is working

Test device: Android emulator, Pixel 4, API 30

Screenshot

Before

Ripple is always in default color

before_r.mov

After

Ripple color has changed with thumb color

ripple_fixed.mov

Check different color on each state

ripple_different_color.mov

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jan 4, 2021
Copy link

@analysis-bot analysis-bot left a comment

Choose a reason for hiding this comment

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

Code analysis results:

@analysis-bot
Copy link

analysis-bot commented Jan 4, 2021

Platform Engine Arch Size (bytes) Diff
ios - universal n/a --

Base commit: 8aea930

@facebook-github-bot
Copy link
Contributor

@lunaleaps has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@lunaleaps merged this pull request in 1b06835.

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Apr 12, 2021
@lunaleaps
Copy link
Contributor

Thank you @rnike for this PR and tests! I've merged it in!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Platform: Android Android applications.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong ripple color in Switch component
5 participants