Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-892] View 'visible' property not updated by show() or hide()

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2015-03-04T18:09:51.000+0000
Affected Version/sn/a
Fix Version/sSprint 2012-03, Release 1.8.2, Release 4.0.0
ComponentsAndroid
Labelsandroid, defect, exalture, module_views, parity, qe-4.0.0, qe-testadded, training
ReporterBill Dawson
AssigneeStephen Tramer
Created2011-04-15T02:38:41.000+0000
Updated2015-03-04T18:09:51.000+0000

Description

Though hide() & show() are handled appropriately in views, the state of the property 'visible' is never changed. If you pass visible: false in the createXXX() method, it will be respected and used (the view will be hidden), but the value of .visible never changes again even after calling show(). See TiUIView.show() and TiUIView.hide().

Comments

  1. Stephen Tramer 2012-01-27

    TESTING

    ---- Sample code:
       var win = Ti.UI.createWindow({
       	backgroundColor:'white'
       });
       
       var view = Ti.UI.createView({
       	backgroundColor:'red',
       	width:100,
       	height:100,
       	top:20
       });
       win.add(view);
       
       var b = Ti.UI.createButton({
       	title:'Show/hide',
       	width:140,
       	height:40,
       	top:160
       });
       b.addEventListener('click', function() {
       	Ti.API.info('Visible: '+view.visible);
       	if (view.visible) {
       		view.hide();
       	}
       	else {
       		view.show();
       	}
       });
       win.add(b);
       
       var b2 = Ti.UI.createButton({
       	title:'Toggle visible',
       	width:140,
       	height:40,
       	top:220
       });
       b2.addEventListener('click', function() {
       	view.visible = !view.visible;
       });
       win.add(b2);
       
       win.open();
       
    Click on both the "show/hide" and "toggle visible" buttons a few times, to make sure that the expected behavior occurs. There may be a secondary bug involving the initial value of view.visible.
  2. Wilson Luu 2012-02-03

    Closing bug. Verified fix on: SDK build: 1.9.0.v20120203160134 Titanium Studio, build: 1.0.8.201201262211 Runtime: V8, Rhino xcode: 4.2 Devices: Droid 1 (2.2.3), iPhone 4S Sprint (5.0.1)
  3. Wilson Luu 2012-02-03

    Reopening to fix fields.
  4. Shameer Jan 2013-10-30

    visible property not updated with other events.It works only with 'click' event.Seems that bug is not fixed
  5. Shameer Jan 2013-10-30

    testcase:
       var win = Ti.UI.createWindow({
           backgroundColor:'white'
       });
        
       var view = Ti.UI.createView({
           backgroundColor:'red',
           width:100,
           height:100,
           top:20
       });
       win.add(view);
        	view.visible = !view.visible;   //to avoid initial secondary bug; 
       	view.hide();
       	Ti.API.info('called  view.hide(): '+view.visible);
                   
           view.show();
           Ti.API.info('called  view.show(): '+view.visible);
       	win.open();
       
  6. Ingo Muschenetz 2014-10-23

    Updated PRs merged. [~hpham] and [~sunila], in the future, please add comments to the JIRA ticket so it's obvious why the status is updated.
  7. Ewan Harris 2015-03-04

    Verified fix on: Mac OSX 10.10.2 Appcelerator Studio, build: 4.0.0.201502171827 Titanium SDK build: 4.0.0.v20150227132702 Titanium CLI, build: 3.5.0-dev Alloy: 1.5.1 Android build tools: 21.1.2 Nexus 6 (5.0.1), Samsung Galaxy S3 (4.4.2) Built to both devices, the visible property is now updated by the show and hide methods. Closing ticket.

JSON Source