Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-13637] iOS: visible property has no effect on buttons added to a toolbar

GitHub Issuen/a
TypeBug
PriorityLow
StatusReopened
ResolutionUnresolved
Affected Version/sRelease 3.1.0
Fix Version/sn/a
ComponentsiOS
Labelsreprod
ReporterChristopher R McGuire
AssigneeUnknown
Created2013-04-18T16:02:55.000+0000
Updated2018-02-28T20:04:19.000+0000

Description

*Problem description* When setting the visible attribute to false on a button added to a toolbar, the button is not hidden. *Steps to reproduce* Run either test case and see that button 1 is not hidden. *Standard test case*
var win = Ti.UI.createWindow({
	backgroundColor : "#FFF"
});

var button1 = Titanium.UI.createButton({
	title : 'Button 1',
	visible : false
});

var button2 = Titanium.UI.createButton({
	title : 'Button 2',
});

flexSpace = Titanium.UI.createButton({
	systemButton : Titanium.UI.iPhone.SystemButton.FLEXIBLE_SPACE
});

var toolbar = Titanium.UI.iOS.createToolbar({
	items : [button1, flexSpace, button2],
	bottom : 0,
	borderTop : true,
	borderBottom : false
});
win.add(toolbar);

win.open();
*Alloy test case*
<Alloy>
    <Window class='container'>
        <Toolbar bottom='0' borderTop='true' borderBottom='false'>
            <Items>
                <Button visible='false' id='btn1'>Button 1</Button>
                <Button id='btn2'>Button 2</Button>
            </Items>
        </Toolbar>
    </Window>
</Alloy>
With the above, both buttons will display, although btn1 should be hidden from the view.

Comments

  1. Christopher R McGuire 2013-04-19

    Hi there- Actually, I had the property set in my .tss file at first, where I simply set it as a visible: false...I moved it to the xml for the simplicity of the example. When in the .tss I still did not get it to work. I see above that yo are creating the button specifically in code with no visible attributes. Can you try with the visible attributes using a tss file? Or is this attribute not supported, or not supported in Alloy, or not supported in Alloy in the xml or tss or both? If so, is this documented behavior? Thanks.
  2. Daniel Sefton 2013-04-20

    Hi Chris, Sorry, disregard my last comment, I didn't realise it was buttons which are added to a toolbar since you didn't mention it in the title or description. (Standard buttons work fine) I've confirmed your issue with Ti SDK 3.1 GA, iOS 6 simulator and will escalate it to engineering.
  3. Lee Morris 2017-07-06

    I am able to reproduce this issue with the following environment; iPhone 7 (10.2) Studio 4.9.0.201705302345 Ti SDK 6.1.1 GA Appc NPM 4.2.9 Appc CLI 6.2.2 Ti CLI 5.0.14 Alloy 1.9.11 Xcode 8.2 (8C38) Node v4.8.2 Java 1.8.0_131

JSON Source