Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9572] Android: Views: The visible property of a view is undefined by default

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2013-06-17T22:57:23.000+0000
Affected Version/sRelease 2.1.0, Release 3.1.0
Fix Version/s2013 Sprint 12 API, 2013 Sprint 12, Release 3.2.0
ComponentsAndroid
Labelsapi, module_view, qe-and060112, qe-testadded
ReporterSatyam Sekhri
AssigneeBiju pm
Created2012-06-15T11:40:06.000+0000
Updated2014-03-12T10:36:49.000+0000

Description

The default value of a view added to a window is "undefined". This is not a regression. The behavior exists as far as 1.8.2 Steps to reproduce: 1. Create an application with code below and launch the application 2. Click on Show/Hide button Actual: An alert with value "undefined" is shown which is the value of visible property of view. Expected: The value should be returned as "true"
var _window = Ti.UI.createWindow({
		backgroundColor:'white'
		});

		var view = Ti.UI.createView({
			backgroundColor:'red',
			width:100,
			height:100,
			top:20
		});
		_window.add(view);
		
		var b = Ti.UI.createButton({
			title:'Show/hide',
			width:140,
			height:40,
			top:160
		});
		
		b.addEventListener('click', function() {
			alert('Visible: '+view.visible);
			if (view.visible) {
				view.hide();
			}
			else {
				view.show();
			}
		});
		_window.add(b);
		_window.open();

Comments

  1. jithinpv 2013-03-05

    Issue reproduces with Titanium Studio, build: 3.0.1.201212181159 Titanium SDK version: 3.1.0 (03/11/13 15:43 0c88429) Titanium SDK version: 3.0.2 (02/07/13 16:46 a4def81) Android Emulator: Android SDK version: 2.2
  2. Biju pm 2013-06-13

    Set the visible property of a view is true https://github.com/appcelerator/titanium_mobile/pull/4387
  3. Priya Agarwal 2013-10-21

    Closing for android and opened new bug for iOS. Verified the fix with: Appc-Studio: 3.2.0.201310181700 Sdk:3.2.0.v20131018154951 alloy:1.2.2 npm:1.3.2 titanium:3.2.0 titanium-code-processor:1.0.3 Device:Samsung Note(v2.3.6),iphoneSimulator(v7) Xcode: 5 visible property of view is not undefined by default now it returns boolean value.(true/false) Closing this issue for android but have opened new issue for iOS TIMOB-15543

JSON Source