The Problem:
When the window changes orientation, if it's modal, it's children end up behind the nav bar.
Code Sample:
var win = Ti.UI.createWindow({
orientationModes:[
Titanium.UI.PORTRAIT,
Titanium.UI.UPSIDE_PORTRAIT,
Titanium.UI.LANDSCAPE_LEFT,
Titanium.UI.LANDSCAPE_RIGHT
]
});
var view = Ti.UI.createView({
backgroundColor:'white'
});
var label = Ti.UI.createLabel({
top:0,
height:10,
text:'lalalalala'
});
view.add(label);
win.add(view);
win.open({modal:true});
To Reproduce:
Run the code above in app.js and rotate the device/simulator
Behavior:
- What happens: View with the label with text "lalalala" ends up under the navbar and invisible to the user
- What has to happen: View containing the label has to resize accordingly
*NOTE:* Only check this for correct orienting. There is a bug related to this test, TIMOB-7854, which covers closing and reopening a window over a modal. Any fix for this also needs to pass the "sandwich test" (where the modal is "sandwiched" between two normal windows):
var toplevel = Ti.UI.createWindow({ orientationModes:[ Ti.UI.PORTRAIT, Ti.UI.UPSIDE_PORTRAIT ], backgroundColor:'white' }); var win = Ti.UI.createWindow({ orientationModes:[ Titanium.UI.LANDSCAPE_LEFT, Titanium.UI.LANDSCAPE_RIGHT ], backgroundColor:'white' }); var win2 = Ti.UI.createWindow({ orientationModes:[Ti.UI.LANDSCAPE_LEFT], backgroundColor:'white' }); var b = Ti.UI.createButton({ title:'open', width:100, height:50 }); b.addEventListener('click', function() { win.open({modal:true}); }); var b2 = Ti.UI.createButton({ title:'open', width:100, height:50, top:20 }); b2.addEventListener('click', function() { win2.open(); }); var b3 = Ti.UI.createButton({ title:'close', width:100, height:50, bottom:20 }); b3.addEventListener('click', function() { win.close(); }); var b4 = Ti.UI.createButton({ title:'close', width:100, height:50, bottom:20 }); b4.addEventListener('click', function() { win2.close(); }); toplevel.add(b); win.add(b2); win.add(b3); win2.add(b4); toplevel.open();Linked to possible regressions.
Closing bug. Verified fix on: SDK build: 2.0.0.v20120315140247 Titanium Studio, build: 2.0.0.201203142055 xcode: 4.2 Device: iphone 4s (5.0.1)
Also, only tested the *Code Sample* for correct orientation.
No regression occurred when testing TIMOB-4619, TIMOB-1634, TIMOB-6551, TIMOB-6391 on: SDK build: 2.0.0.v20120315140247 Titanium Studio, build: 2.0.0.201203142055 xcode: 4.2 Device: iphone 4s (5.0.1), ipad2 (4.3.5)
Open to update label