Titanium JIRA Archive
Alloy (ALOY)

[ALOY-1164] Alloy: Not possible to hide View inside TextArea

GitHub Issuen/a
TypeBug
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsRuntime
LabelsTCSupport, textarea, view, visible
ReporterMatej
AssigneeUnknown
Created2014-10-08T13:24:29.000+0000
Updated2018-03-07T22:25:43.000+0000

Description

Problem Description

It is not possible to hide a view within TextArea. Properties/Methods visible, hide, show are basically ignored. Works fine in Classic Ti and it worked in Alloy too... (I can't say exactly in what version ,but it worked for sure...).

Testcase

index.js
function hideRedView(e) {
	$.redView.visible = !$.redView.visible;
	console.log("RED VIEW SHOULD BE: " + ($.redView.visible ? "shown" : "hidden"));
};

$.index.open();
index.xml
<Alloy>
	<Window>
		<TextArea id="textArea">
			<View id="redView"/>
		</TextArea>
		
		<Button title="Click!" onClick="hideRedView"/>
	</Window>
</Alloy>
index.tss
"Window": {
	backgroundColor: "white",
	layout: "vertical"
}

"#textArea": {
	width: "80%", height: 300,
	borderWidth: "1px",
	borderColor: "gray",
	top: 30
}

"#redView": {
	width: 100, height: 100,
	backgroundColor: "red"
}

Extra information

The Support Team tested this in Ti Classic, is working just fine. The testcase is in a comment.

Comments

  1. Harish Mridha 2014-10-14

    Hi, We tried to reproduce this issue with the given sample test code. It’s a valid bug. It doesn’t work in Alloy but works fine in Ti Classic.

    TESTING ENVIRONMENT:

    Ti SDK 3.4.0.GA Ti CLI 3.4.0 Alloy 1.5.1 Mac OS X 10.9.5 iOS v8.0

    TEST CODE:

     
       var win = Ti.UI.createWindow({
       	backgroundColor:'#fff',
       	layout:'vertical'
       });
       
       var textArea = Ti.UI.createTextArea({
         borderWidth: 2,
         borderColor: '#bbb',
         borderRadius: 5,
         color: '#fff',
         top: 30,
         width: '80%', height : 300
       });
       win.add(textArea);
       
       var view = Titanium.UI.createView({
          backgroundColor:'red',
          width:100,
          height:100
       });
       textArea.add(view);
       
       var aButton = Ti.UI.createButton({
       	title : 'Click',
       	height : 'auto',
       	width : 'auto',
       	top : 20,
       });
       
       aButton.addEventListener('click', function() {
       	view.visible = !view.visible;
       });
       
       win.add(aButton);
       win.open();
       

    STEPS TO TEST:

    - Create a simple project. - Update project with test code - Run on iOS device/ simulator

    EXPECTED RESULT:

    It’s not working as expected. Thanks
  2. Mauro Parra-Miranda 2014-10-14

    [~skypanther]: The original reporter is [~sko]. Thanks!
  3. Tim Poulsen 2014-10-14

    Adding child views to TextArea is supported on only iOS. Even there, our docs recommend to instead use a wrapper view around the TextArea with the "child" view inside that wrapper, overlaying the TextArea. Doing so would be a suitable workaround until we can resolve this issue.

JSON Source