[TIMOB-25838] iOS: Horizontal/Vertical layout miscalculates percent width/height when default unit is not "dp"
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Open |
Resolution | Unresolved |
Affected Version/s | Release 6.3.0, Release 8.0.0 |
Fix Version/s | n/a |
Components | iOS |
Labels | defaultunit, engSchedule, ios, layout, percent |
Reporter | Joshua Quick |
Assignee | Unknown |
Created | 2018-03-06T02:30:57.000+0000 |
Updated | 2019-04-16T16:16:10.000+0000 |
Description
*Summary:*
When setting the "tiapp.xml" property "ti.ui.defaultunit" to a unit other than "dp", layouts "vertical" and "horizontal" will miscalculate percentage based "width" and "height" properties.
*Steps to Reproduce:*
Modify project's "tiapp.xml" with the below "ti.ui.defaultunit" property. (Sets it to pixels.)
Build and run the below JavaScript on an iOS device.
Observe the size of the gray rectangle. It's supposed to be 50% wide and 50% tall.
<?xml version="1.0" encoding="UTF-8"?>
<ti:app xmlns:ti="http://ti.appcelerator.org">
<property name="ti.ui.defaultunit" type="string">px</property>
</ti:app>
var window = Ti.UI.createWindow(
{
layout: "vertical",
// layout: "horizontal",
});
window.add(Ti.UI.createView(
{
backgroundColor: "gray",
borderColor: "black",
borderWidth: "1dp",
top: "25%",
left: "25%",
width: "50%",
height: "50%",
}));
window.open();
*Result:*
Looks like attached "Screenshot-Bad.png" where the gray rectangle is *NOT* centered onscreen, with a 50% width and 50% height.
*Expected Result:*
Should look like attached "Screenshot-Good.png".
*Notes:*
* This bug does not occur if "ti.ui.defaultunit" is set to "dp".
* This bug does not occur with "composite" layouts, which works with all units.
* This is not an issue with percentage based "top", "bottom", "left", or "right" properties.
* This is not an issue on Android.
Attachments
File | Date | Size |
---|---|---|
Screenshot-Bad.png | 2018-03-06T02:28:23.000+0000 | 20057 |
Screenshot-Good.png | 2018-03-06T02:28:27.000+0000 | 20007 |
No comments