Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23430] Windows 10: Ti.UI.Switch default position is not centered

GitHub Issuen/a
TypeBug
PriorityNone
StatusClosed
ResolutionInvalid
Resolution Date2016-05-31T18:06:03.000+0000
Affected Version/sRelease 5.3.0
Fix Version/sn/a
ComponentsWindows
Labelsqe-5.3.0
ReporterHarry Bryant
AssigneeGary Mathews
Created2016-05-24T17:55:41.000+0000
Updated2016-05-31T18:06:03.000+0000

Description

When positioning is not specified for a switch, it should be centered by default. This is the case for Windows 8.1 devices, however not for Windows 10 devices. _(see screenshots)_

DEMO CODE:

var win = Titanium.UI.createWindow({  
    title:'Tab 5',
    backgroundColor:'green'
});

var basicSwitch = Ti.UI.createSwitch({
  borderRadius: 5,
  borderWidth: 8,
  borderColor: 'red', 
  titleOn:'Notifications Enabled',
  titleOff:'Notifications Disabled',
  value:true,
  width: '80%',
  height:120,
  top: 200
});
win.add(basicSwitch);
win.open();

Steps to Reproduce

1. Create a classic mobile project. 2. Include the demo code in the app.js. 3. Build to windows 10 mobile device or emulator.

Actual Result

Switch is positioned to the left, not centered.

Expected Result

Switch should be positioned in center by default.

Attachments

FileDateSize
example.JPG2016-05-27T00:12:39.000+000015050
win_10.png2016-05-24T17:55:39.000+000054702
win_8.1.png2016-05-24T17:55:39.000+000060298

Comments

  1. Gary Mathews 2016-05-27

    I don't believe this is an issue, the Ti.UI.Switch is centered to the View but the component is left aligned (like Ti.UI.Label). The test case provided sets the width of the Ti.UI.Switch to 80%. On Windows 10, due to the UI of the OS; the switch is left aligned with the text, instead of being right aligned like on Windows 8.1. *EXAMPLE*
       var win = Titanium.UI.createWindow({backgroundColor: 'red'}),
           toggle = Ti.UI.createSwitch({
               backgroundColor: 'orange',
               titleOn: 'Enabled', titleOff: 'Disabled',
               width: '80%'
           });
       win.add(toggle);
       win.open();
       
    !example.JPG|thumbnail!
  2. Harry Bryant 2016-05-31

    Closing this ticket as invalid, using [~gmathews]'s test code showed the actual dimensions of the Switch when the width is set, removing the width property correctly centers the element.

JSON Source