Search code examples
tabstitaniumappcelerator

Titanium : Disabling a tab within a TabGroup


Im trying to get the first and last tab of the TabGroup to be disable so I can give them custom functionality instead of switching the view. I have tried touchEnabled = false and a handfull of other stuff and I'm cant seem to get anything to work ... any ideas?

function TabView() {

var viewOne = require('ui/common/...');
var viewTwo = require('ui/common/...');
var viewTree = require('ui/common/...');
var self = Ti.UI.createTabGroup();

var tab1 = Titanium.UI.createTab({
    title : 'Tab 1'
});

var firstView = viewOne();
var tab2 = Ti.UI.createTab({
    title: L('firstView'),
    icon: '/images/...',
    window: firstView,
    active:true
});
firstView.containingTab = tab2;

var secondView = viewTwo();
var tab3 = Ti.UI.createTab({
    title: L('secondView'),
    icon: '/images/...',
    window: secondView
});
secondView.containingTab = tab3;

var thirdView = viewTree();
var tab4 = Ti.UI.createTab({
    title: L('Map'),
    icon: '/images/....',
    window: thirdView
});
thirdView.containingTab = tab4;

var tab5 = Titanium.UI.createTab({
    title : 'Tab 5'
});

var tabArray = [tab1, tab2, tab3, tab4, tab5];
for ( i = 0; i < tabArray.length; i++) {
    self.addTab(tabArray[i]);
}

return self;
}

module.exports = TabView;

Solution

  • You can have a look at this post to disable a Tab within TabGroup.