What happens:
On first rotation no event is triggered. On every orientation change thereafter, the wrong orientation is returned. I have observed similar behavior on a physical device but I can not reproduce it consistently. In genymotion it happens every time.
Note: The project must be an alloy project. The problem does not occur in a non alloy project. Orientation works correctly in TI SDK 4.0.0.GA
How to reproduce:
1. Create new Empty alloy project
2. Set index.js to:
function doClick(e) {
alert($.label.text);
}
$.index.open();
Ti.Gesture.addEventListener('orientationchange', gestureChange);
function gestureChange(e) {
console.log('orientation change...');
console.log(e);
}
3. Start app in genymotion
4. Output from console:
First rotation results in no output. Next rotation back into Portrait results in the following:
[INFO] orientation change...
[INFO] {"type":"orientationchange","source":{"landscape":true,"bubbleParent":true,"orientation":2,"apiName":"Ti.Gesture","portrait":false,"_events":{"orientationchange":{}}},"orientation":2,"bubbles":false,"cancelBubble":false}
Then rotating into Lanscape results in the following:
[INFO] orientation change...
[INFO] {"type":"orientationchange","source":{"landscape":false,"bubbleParent":true,"orientation":1,"apiName":"Ti.Gesture","portrait":true,"_events":{"orientationchange":{}}},"orientation":1,"bubbles":false,"cancelBubble":false}
I confirm. May be related to TIMOB-18956
Also 5.0.2 not only Alloy but in Genymotion only To test run KitchenSink: BASE UI -> Views -> List View -> Default Template
Any update on this? I have the same issue in Ti SDK 5.1.0.GA, non-Alloy project.
This problem is still present and a pain in the ass, any update on this? Working on SDK 6.2.2.GA. Clean Alloy project. Happens in EVERY simulator. Screencast: https://streamable.com/dhm5i As you can see the first change isn't detected at all. After that the value is wrong (landscape is detected as portrait and visa versa). EDIT: also, switching from portrait to landscape (left/right) on a Samsung Tab 3 (Android 4.4.2) causes very inconstistant results: [ERROR] : {"type":"orientationchange","source":{"landscape":true,"portrait":false,"orientation":1,"apiName":"Ti.Gesture","bubbleParent":true,"_events":{"orientationchange":{}}},"orientation":1,"bubbles":false,"cancelBubble":false} [ERROR] : {"type":"orientationchange","source":{"landscape":true,"portrait":false,"orientation":2,"apiName":"Ti.Gesture","bubbleParent":true,"_events":{"orientationchange":{}}},"orientation":2,"bubbles":false,"cancelBubble":false} [ERROR] : {"type":"orientationchange","source":{"landscape":false,"portrait":true,"orientation":1,"apiName":"Ti.Gesture","bubbleParent":true,"_events":{"orientationchange":{}}},"orientation":1,"bubbles":false,"cancelBubble":false} [ERROR] : {"type":"orientationchange","source":{"landscape":false,"portrait":true,"orientation":4,"apiName":"Ti.Gesture","bubbleParent":true,"_events":{"orientationchange":{}}},"orientation":4,"bubbles":false,"cancelBubble":false}
PR https://github.com/appcelerator/titanium_mobile/pull/9525
PR (master): https://github.com/appcelerator/titanium_mobile/pull/9585
FR Passed. Waiting for merge to get enabled to merge.
PR merged.
Changes are seen in SDK 7.0.0.v20171114202841.