FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(android-styling): correctly detect if drawable uses ColorFilter (… · NativeScript/NativeScript@11d3884 · GitHub

Commit 11d3884

Browse files
authored andcommitted
fix(android-styling): correctly detect if drawable uses ColorFilter (#6342)
* fix(android-styling): correctly detect if drawable uses ColorFilter 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 #6341 * test(button): add test for changing border-radius and color in button * test: fix test checks for IOS * keep original drawable cached
1 parent 00c25b7 commit 11d3884

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

‎tests/app/ui/button/button-tests.ts‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,3 +404,18 @@ export function test_setting_formattedText_With_UnknownFont_DoesNotCrash() {
404404
TKUnit.waitUntilReady(() => btn.isLayoutValid);
405405
});
406406
}
407+
408+
export function test_Native_Background_Color_BorderRadius_Change() {
409+
let view = new buttonModule.Button();
410+
view.text = "TEST";
411+
helper.buildUIAndRunTest(view, function (views: Array<viewModule.View>) {
412+
let page = <pagesModule.Page>views[1];
413+
page.css = ".border { background-color: #00FF00; border-radius: 1; } .colorfilter { background-color: #FF0000; }";
414+
view.className = "border";
415+
helper.waitUntilLayoutReady(view);
416+
TKUnit.assertEqual(buttonTestsNative.getNativeBackgroundColor(view).hex, "#00FF00");
417+
view.className = "colorfilter";
418+
helper.waitUntilLayoutReady(view);
419+
TKUnit.assertEqual(buttonTestsNative.getNativeBackgroundColor(view).hex, "#FF0000");
420+
});
421+
}

‎tns-core-modules/ui/styling/background.android.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export module ad {
5050

5151
if (isSetColorFilterOnlyWidget(nativeView)
5252
&& drawable
53+
&& !(drawable instanceof org.nativescript.widgets.BorderDrawable)
5354
&& !background.hasBorderWidth()
5455
&& !background.hasBorderRadius()
5556
&& !background.clipPath

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL