[TIMOB-8705] Android: Orientation change doesn't properly reflect the behavior for 'auto' properties
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2012-04-16T16:32:37.000+0000 |
Affected Version/s | Release 1.8.1 |
Fix Version/s | n/a |
Components | Android |
Labels | core, parity |
Reporter | Junaid Younus |
Assignee | Marshall Culpepper |
Created | 2012-04-12T15:02:36.000+0000 |
Updated | 2017-03-09T23:25:28.000+0000 |
Description
*Code*
var win = Ti.UI.createWindow({
orientationModes: [ Ti.UI.PORTRAIT,
Ti.UI.UPSIDE_PORTRAIT,
Ti.UI.LANDSCAPE_LEFT,
Ti.UI.LANDSCAPE_RIGHT ],
backgroundColor: 'white'
});
var view = Ti.UI.createView({
width: 100,
height: 100,
backgroundColor: 'red'
});
Ti.Gesture.addEventListener('orientationchange', function(e)
{
if (e.orientation == Titanium.UI.PORTRAIT ||
e.orientation == Titanium.UI.UPSIDE_PORTRAIT)
{
Ti.API.info('In portrait mode.');
view.left = 'auto';
}
else if (e.orientation == Titanium.UI.LANDSCAPE_LEFT ||
e.orientation == Titanium.UI.LANDSCAPE_RIGHT)
{
Ti.API.info('In landscape mode.');
view.left = 10;
}
});
win.add(view);
win.open();
*Expected behavior*
When you rotate the device from portrait to landscape -> the red square should be 10px from the left.
Now if you rotate back from landscape to portrait -> the square should be in the center again.
*Actual behavior*
On the iOS simulator, this is perfectly fine.
On an Android device, instead of moving back to the center, left = 0.
*Notes*
-Only tested on the iOS simulator & HTC Sensation 4G.
-Will update customer priority, once I get a reply. *EDIT* Updated priority.
-HD ticket: http://support-admin.appcelerator.com/display/APP-647528
'auto' is not a valid value for a positioning pin (left, right, top, bottom, center). 'auto' is supposed to be used with dimension parameters only. Invalid values on IOS are treated as undefined and as 0 on Android.
Thanks Vishal, makes sense. This ticket can be closed/marked as invalid.
Closing ticket as invalid.