Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-8880] iOS: setBadge() does nothing on Tab if icon is not set

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionNot Our Bug
Resolution Date2016-11-28T22:10:55.000+0000
Affected Version/sRelease 2.0.1, Release 3.1.0
Fix Version/sn/a
ComponentsiOS
Labelsapi
ReporterTony Lukasavage
AssigneeHans Knöchel
Created2012-04-25T06:23:43.000+0000
Updated2017-03-23T21:20:33.000+0000

Description

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();

Comments

  1. Shameer Jan 2013-04-16

    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
  2. Hans Knöchel 2016-11-28

    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.
  3. Lee Morris 2017-03-23

    Closing ticket with reference to the above comments.

JSON Source