Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
On Android, setting a view's background drawable alpha to anything from 1 to 254 (for example
view.background.alpha = 128) makes its border disappear, while the background color fades as expected.CompositeBackgroundDrawablepasses the alpha down toBorderDrawable, andmultiplyColorAlphathere computescolorAlpha * (alpha shr 7) shr 8.alpha shr 7is only ever 0 or 1, so the border color alpha always ends up 0.It now multiplies by the 0..256 alpha itself, so a border at alpha 128 draws at half its color alpha. 0 and 255 already return early and don't change.
Fixes #59963
Changelog:
[ANDROID] [FIXED] - Setting a view's background drawable alpha no longer makes its border fully transparent
Test Plan:
Added
BorderDrawableTest.settingAlphaScalesBorderColorAlpha, which setsalpha = 128on a drawable with a red border, draws it and checks the border paint alpha is 128. It fails onmain(the alpha is 0) and passes with this change../gradlew :packages:react-native:ReactAndroid:testDebugUnitTestpasses andyarn format-check-kotlinis clean. I didn't run the reproducer on a device.