[TIMOB-23430] Windows 10: Ti.UI.Switch default position is not centered
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | None |
| Status | Closed |
| Resolution | Invalid |
| Resolution Date | 2016-05-31T18:06:03.000+0000 |
| Affected Version/s | Release 5.3.0 |
| Fix Version/s | n/a |
| Components | Windows |
| Labels | qe-5.3.0 |
| Reporter | Harry Bryant |
| Assignee | Gary Mathews |
| Created | 2016-05-24T17:55:41.000+0000 |
| Updated | 2016-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
| File | Date | Size |
|---|---|---|
| example.JPG | 2016-05-27T00:12:39.000+0000 | 15050 |
| win_10.png | 2016-05-24T17:55:39.000+0000 | 54702 |
| win_8.1.png | 2016-05-24T17:55:39.000+0000 | 60298 |
I don't believe this is an issue, the
Ti.UI.Switchis centered to theViewbut the component is left aligned (likeTi.UI.Label). The test case provided sets thewidthof theTi.UI.Switchto80%. 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*!example.JPG|thumbnail!var win = Titanium.UI.createWindow({backgroundColor: 'red'}), toggle = Ti.UI.createSwitch({ backgroundColor: 'orange', titleOn: 'Enabled', titleOff: 'Disabled', width: '80%' }); win.add(toggle); win.open();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.