Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-13146] iOS: Changing BorderStyle at runtime a few times causes rounded textField background colour to become transparent

GitHub Issuen/a
TypeBug
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 3.0.2, Release 3.1.0
Fix Version/sn/a
ComponentsiOS
LabelsbackgroundColor, iOS, mobile, reprod, textfield
ReporterFrancois Stephany
AssigneeUnknown
Created2012-10-12T16:24:35.000+0000
Updated2018-02-28T20:03:24.000+0000

Description

After clicking switchButton several times, the textField's background colour becomes transparent. It should maintain its state. -Changing the borderStyle of a textfield at runtime seems to change its background color.- -My goal is to have a "disabled look" for a textfield by removing its border at runtime. When setting it to round border again, its background becomes transparent instead of white (as it originally is).- The following app.js shows the issue {noformat} var win = Titanium.UI.createWindow({ backgroundColor:'red', layout: 'vertical', }); var textField = Titanium.UI.createTextField({ top: '20dp', width: '80%', value: 'Titanium', borderStyle: Ti.UI.INPUT_BORDERSTYLE_ROUNDED, touchEnabled: true, }) var switchButton = Titanium.UI.createButton({ top: '10dp', width: '80%', title: 'Toggle' }) switchButton.addEventListener('click', function(){ if(textField.touchEnabled){ textField.borderStyle = Ti.UI.INPUT_BORDERSTYLE_NONE; textField.touchEnabled = false; //textField.backgroundColor = 'transparent'; // try to uncomment to see } else { textField.borderStyle = Ti.UI.INPUT_BORDERSTYLE_ROUNDED; textField.touchEnabled = true; //textField.backgroundColor = 'white'; // try to uncomment to see } }); win.add(textField); win.add(switchButton); win.open(); {noformat} -When manually changing the backgroundColor to white to circumvent the problem, the corner of the textfield becomes white without respecting the rounded property (see screenshot).-

Attachments

FileDateSize
Screen Shot 2012-10-12 at 18.21.00.png2012-10-12T16:24:35.000+000017663
Screen Shot 2012-10-12 at 18.21.49.png2012-10-12T16:24:35.000+000019236

Comments

  1. Daniel Sefton 2013-03-21

    Tested and confirmed described behavior on iOS 6 simulator, SDK 3.0.2 GA. However, what you have to understand is that when you set Ti.UI.INPUT_BORDERSTYLE_ROUNDED, the background colour of the round-cornered text field (white) is independent of the backgroundColor property. You can confirm this by setting a (blue) backgroundColor on the textField at creation. But, what IS a bug, is that when you change the borderStyle a few times, the background colour of the text field becomes transparent, which shouldn't happen. So for that, I will move it to TIMOB.
  2. jithinpv 2013-05-03

    issue reproduces Tested with Titanium Studio, build: 3.0.1.201212181159 Titanium SDK version: 3.1.0 iOS iPhone Simulator: iOS SDK version: 6.0
  3. Lee Morris 2017-06-19

    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.v20170609091155 Appc NPM 4.2.9 Appc CLI 6.2.1 Ti CLI 5.0.13 Alloy 1.9.11 Arrow 2.0.0 Xcode 8.2 (8C38) Node v4.8.2 Java 1.8.0_131

JSON Source