Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-25023] Windows: BackgroundColor won't get applied when touchEnabled=false

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2017-08-04T18:10:16.000+0000
Affected Version/sRelease 6.1.0
Fix Version/sRelease 6.2.0
ComponentsWindows
Labelsn/a
ReporterShuo Liang
AssigneeKota Iguchi
Created2017-07-26T02:50:38.000+0000
Updated2017-08-15T22:21:46.000+0000

Description

It seems that if you try setting certain properties like backgroundColor in the controller and NOT in the tss file, these get ignored.

Reproduce Steps:

1) Open example code attacheded in a alloy project. 2) Observe how $.square has no backgroundColor defined (commented out, line 26) 3) In index.js observe how $.square's backgroundColor is being set (to backgroundColorChecked, which is equal to red). 4) Compile and run app (can be done with -T ws-local) 5) When app launches, observe how $.square seems not to show, like it's not there. That's because the backgroundColor set in line 4 of index.js didn't really work 6) Also, observe how $.square.backgroundColorChecked=red and $.square.backgroundColorUnchecked=blue prints in the console, so the reference to the colors actually exists. 7) Go to index.tss and uncomment line #26 out. 8) Compile the app and run it again. Observe how the backgroundColor is indeed applied this time to $.square. 9) Also observe how width and height values set in lines 6 and 7 of index.js seem to be applied to $.square just fine, unlike backgroundColor.

Note

Tested this with Android and iOS and it works there.

Plus

Same EXACT behavior happens with the backgroundImage property of Ti.UI.View AND color property of a Ti.UI.Label.

Attachments

FileDateSize
index.js2017-07-26T02:50:14.000+0000306
index.tss2017-07-26T02:50:31.000+0000709
index.xml2017-07-26T02:50:06.000+0000135

Comments

  1. Kota Iguchi 2017-08-02

    It turns out that the root problem is backgroundColor doesn't get applied when it is used with touchEnabled=false. I would change the title of this ticket then. Sample code:
       var win = Ti.UI.createWindow({
         backgroundColor: 'blue'
       });
       var view = Ti.UI.createView({
           width:  5,
           height: 5,
           touchEnabled: false,
           backgroundColor: 'green'
       });
       
       win.addEventListener('open', function () {
           view.width = 50;
           view.height = 50;
           view.backgroundColor = 'red';
       });
       
       win.add(view);
       win.open();
       
  2. Kota Iguchi 2017-08-02

    https://github.com/appcelerator/titanium_mobile_windows/pull/1057
  3. Samir Mohammed 2017-08-02

    [~kiguchi]Will this ticket need a back-port to 6_2_X ?
  4. Kota Iguchi 2017-08-02

    6_2_X: https://github.com/appcelerator/titanium_mobile_windows/pull/1058
  5. Kota Iguchi 2017-08-04

    [~smohammed] Backported to 6_2_X. No tests needed for 6_2_X because currently 6_2_X branch and master are pretty much same. Should be ok to close this ticket.
  6. Samir Mohammed 2017-08-15

    Verified fix in SDK Version 7.0.0.v20170815065413 and SDK Version: 6.2.0.v20170811022027 Test and other information can be found at: Master: https://github.com/appcelerator/titanium_mobile_windows/pull/1059 6_2_X: https://github.com/appcelerator/titanium_mobile_windows/pull/1072 https://github.com/appcelerator/titanium_mobile_windows/pull/1074
  7. Samir Mohammed 2017-08-15

    ^UPDATE: Master: https://github.com/appcelerator/titanium_mobile_windows/pull/1057 6_2_X: https://github.com/appcelerator/titanium_mobile_windows/pull/1058

JSON Source