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

fix(bottom-navigation-android): tabStripItem backgroundColor by ADjenkov · Pull Request #7504 · NativeScript/NativeScript · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .json  (2) .ts  (2) All 2 file types selected
Only manifest files
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
2 changes: 1 addition & 1 deletion tns-core-modules/package.json
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
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "tns-core-modules",
"description": "Telerik NativeScript Core Modules",
"version": "6.0.0",
"version": "6.0.1",
"homepage": "https://www.nativescript.org",
"repository": {
"type": "git",
Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ function createTabItemSpec(tabStripItem: TabStripItem): org.nativescript.widgets
iconSource = tabStripItem.image ? tabStripItem.image.src : tabStripItem.iconSource;
tabItemSpec.title = tabStripItem.label ? tabStripItem.label.text : tabStripItem.title;

if (tabStripItem.backgroundColor instanceof Color) {
tabItemSpec.backgroundColor = tabStripItem.backgroundColor.android;
}

if (iconSource) {
if (iconSource.indexOf(RESOURCE_PREFIX) === 0) {
tabItemSpec.iconId = ad.resources.getDrawableId(iconSource.substr(RESOURCE_PREFIX.length));
Expand Down
26 changes: 12 additions & 14 deletions tns-core-modules/ui/tabs/tabs.android.ts
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
Original file line number Diff line number Diff line change
Expand Up @@ -281,20 +281,18 @@ function initializeNativeClasses() {
TabLayout = TabLayoutImplementation;
}

function createTabItemSpec(item: TabStripItem): org.nativescript.widgets.TabItemSpec {
function createTabItemSpec(tabStripItem: TabStripItem): org.nativescript.widgets.TabItemSpec {
let iconSource;
const tabItemSpec = new org.nativescript.widgets.TabItemSpec();

if (item.backgroundColor) {
if (item.backgroundColor instanceof Color) {
tabItemSpec.backgroundColor = item.backgroundColor.android;
}
if (tabStripItem.backgroundColor instanceof Color) {
tabItemSpec.backgroundColor = tabStripItem.backgroundColor.android;
}

// Image and Label children of TabStripItem
// take priority over its `iconSource` and `title` properties
iconSource = item.image ? item.image.src : item.iconSource;
tabItemSpec.title = item.label ? item.label.text : item.title;
iconSource = tabStripItem.image ? tabStripItem.image.src : tabStripItem.iconSource;
tabItemSpec.title = tabStripItem.label ? tabStripItem.label.text : tabStripItem.title;

if (iconSource) {
if (iconSource.indexOf(RESOURCE_PREFIX) === 0) {
Expand All @@ -305,15 +303,15 @@ function createTabItemSpec(item: TabStripItem): org.nativescript.widgets.TabItem
}
} else {
let is = new ImageSource();
if (isFontIconURI(item.iconSource)) {
const fontIconCode = item.iconSource.split("//")[1];
const font = item.style.fontInternal;
const color = item.style.color;
if (isFontIconURI(tabStripItem.iconSource)) {
const fontIconCode = tabStripItem.iconSource.split("//")[1];
const font = tabStripItem.style.fontInternal;
const color = tabStripItem.style.color;
is = fromFontIconCode(fontIconCode, font, color);
} else {
is = fromFileOrResource(item.iconSource);
is = fromFileOrResource(tabStripItem.iconSource);
}

if (is) {
// TODO: Make this native call that accepts string so that we don't load Bitmap in JS.
tabItemSpec.iconDrawable = new android.graphics.drawable.BitmapDrawable(application.android.context.getResources(), is.android);
Expand Down
2 changes: 1 addition & 1 deletion tns-platform-declarations/package.json
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
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tns-platform-declarations",
"version": "6.0.0",
"version": "6.0.1",
"description": "Platform-specific TypeScript declarations for NativeScript for accessing native objects",
"main": "",
"scripts": {
Expand Down

Back | FazBrowse Home | New Git URL