-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
fix(android-styling): correctly detect if drawable uses ColorFilter #6342
fix(android-styling): correctly detect if drawable uses ColorFilter #6342
Conversation
Treat a widget with a BorderDrawable background as any other, even if it's FilterOnly If the drawable has been replaced with a new one, clear _cachedDrawable Fixes NativeScript#6341
Just ran the tests on iOS, they all passed except for a few that are unrelated to this change. |
Hey @edusperoni, |
test |
test |
test |
test |
Hey @edusperoni All unit tests are green, however we picked a strange behavior that has changed in our e2e tests for android. It can be reproduced by running this app (make sure you do
We expect the button to regain its original drawable, but with this PR - it doesn't. I noticed that removing the line that clears the |
The reason I added that line was that the moment we changed the background, the cacheddrawable is dirty. This also means the previous background is no longer being referenced, only it's constantState. This line was added to make sure we're not caching old drawables when creating new ones. So once the view gets a new drawable, it no longer returns to an old drawable. Now I see it may cause this issue on the specific cases (like button) when setting background to empty means returning to the original (not null/BorderDrawable). We also had experienced some issues in our projects where if we changed the background to a color and back (something like
I believe that line may be removed, but there's probably some underlying issue in caching this StateDrawable, |
Hi @edusperoni , Congratulations on being one of the winners in the {N} First-time contributors contest! You can claim your prize by contacting us at nativescriptwinners[at]progress.com not later than Nov 30th 2018 . Make sure you send us the following info: Best regards, |
Hey @edusperoni, Do you think you can reproduce any of the other issues you mentioned? It looks to me that they are not related to this PR. Maybe we can work on them separately as long as this PR does not cause this bug to appear more often. |
test |
test |
test |
test |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
PR Checklist
I reran the tests on an emulator and they all succeeded. iOS tests output the same as without this change.
What is the current behavior?
Changing border-radius makes you unable to change color on Button if border-radius returns to 0
What is the new behavior?
When a background has border-radius and becomes a BorderDrawable, it is no longer considered a background which must have it's color changed by
setColorFilter
.Fixes #6341