tidev / titanium-sdk

🚀 Native iOS and Android Apps with JavaScript
https://titaniumsdk.com/
Other
2.76k stars 1.21k forks source link

fix(android): keep Tab tintColor when changing icons #14080

Closed m1ga closed 3 months ago

m1ga commented 4 months ago

Fixes https://github.com/tidev/titanium-sdk/issues/14079

var tabs = [];
function createTab(title, icon) {
    const window = Ti.UI.createWindow({ title: title });
    window.add(Ti.UI.createLabel({ text: title + " View" }));
    const tab = Ti.UI.createTab({
        title: title,
        icon: icon,
        window: window,
    });
    tabs.push(tab);
    return tab;
}

const tabGroup = Ti.UI.createTabGroup({
    tabs: [
        createTab("Tab 1", "/images/appicon.png"),
        createTab("Tab 2", "/images/appicon.png"),
        createTab("Tab 3", "/images/appicon.png")
    ],
    activeTintColor: "red",
    activeTitleColor: "red",
    tintColor: "purple",
    titleColor: "purple",
    tabsBackgroundColor: "#F7F7F7",
});

setTimeout(function(){
    tabs[0].icon = "/images/appicon.png"
    tabGroup.activeTintColor = "red"
},1000)

tabGroup.open();

before this PR:

https://github.com/user-attachments/assets/25702c83-8ed5-448e-b364-474da4dea396

Red icon will lose activeTintColor.

After the PR: icon stays red