Problem
I am unable to set the
badge
on a tab if the tab does not have its
icon
set. Giving the tab an icon resolves the issue.
Test Case
var tabgroup = Ti.UI.createTabGroup({
backgroundColor: '#fff'
});
var windows = [];
var tabs = [];
var addWindowListener = function(win, tab) {
win.addEventListener('click', function(e) {
if (tab.badge) {
tab.setBadge(null);
} else {
tab.setBadge('23');
}
});
};
for (var i = 0; i < 4; i++) {
windows.push(Ti.UI.createWindow({
title: 'Window ' + (i+1),
backgroundColor: '#a00'
}));
tabs.push(Ti.UI.createTab({
window: windows[i],
title: 'Window ' + (i+1),
// removing the 'icon' property below will make the
// badge fail to appear when you click the window
icon: 'KS_nav_ui.png'
}));
tabgroup.addTab(tabs[i]);
addWindowListener(windows[i], tabs[i]);
}
tabgroup.open();
Issue reproduces Tested with Titanium Studio, build: 3.0.1.201212181159 Titanium SDK version: 3.1.0 Titanium SDK version: 3.0.2 iOS iPhone Simulator: iOS SDK version: 6.0
This is not supposed to work on the native side as well. Tab-badges are attached to their icons and if it's not provided, iOS will ignore the value of the property.
Closing ticket with reference to the above comments.