[TIMOB-17930] Poor rendering performances when opening new window inside tab / nav window
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Open |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | iOS |
Labels | n/a |
Reporter | Ivan Skugor |
Assignee | Unknown |
Created | 2014-10-27T23:07:13.000+0000 |
Updated | 2018-02-28T20:03:23.000+0000 |
Description
Hi.
To see issue run this code:
var tabGroup = Ti.UI.createTabGroup();
var win1 = Ti.UI.createWindow({ backgroundColor: '#f00', title: 'Win 1' });
var win2 = Ti.UI.createWindow({ backgroundColor: '#00f', title: 'Win 2' });
var tab1 = Ti.UI.createTab({ title: 'Red', window: win1 });
var tab2 = Ti.UI.createTab({ title: 'Blue', window: win2 });
tabGroup.addTab(tab1);
tabGroup.addTab(tab2);
function createWin() {
var navButton = Ti.UI.createLabel({
color: "#000",
text: 'Test'
});
var newWin = Ti.UI.createWindow({ backgroundColor: '#0f0', title: 'New Win' });
var scrollView = Ti.UI.createScrollView({ layout: 'vertical' });
for (var i = 0; i < 10; i++) {
var view = Ti.UI.createView({ height: Ti.UI.SIZE, layout: 'vertical', top: 10 });
for (var j = 0; j < 3; j++) {
var l = Ti.UI.createLabel({ text: 'Label ' + j, top: 5 });
view.add(l);
}
scrollView.add(view);
}
newWin.add(scrollView);
newWin.leftNavButton = navButton;
return newWin;
}
win1.add(Ti.UI.createLabel({ text: 'Win open in tab bug' }));
win2.add(Ti.UI.createLabel({ text: 'Win open in nav win bug' }));
win1.addEventListener('click', function() {
var newWin = createWin();
newWin.leftNavButton.addEventListener('click', function() {
tab1.close(newWin);
});
tab1.open(newWin);
});
win2.addEventListener('click', function() {
var navwin2 = Titanium.UI.createWindow({
backgroundColor: '#fff',
title: 'Red Window'
});
navwin2.add(Ti.UI.createLabel({ text: 'Click to open new win', top: 50 }));
var closeLabel = Ti.UI.createLabel({ text: 'Click to close', top: 150 });
navwin2.add(closeLabel);
closeLabel.addEventListener('click', function() {
navwin1.close();
});
var navwin1 = Titanium.UI.iOS.createNavigationWindow({
window: navwin2
});
navwin2.addEventListener('click', function() {
var newWin = createWin();
newWin.leftNavButton.addEventListener('click', function() {
navwin1.closeWindow(newWin);
});
navwin1.openWindow(newWin);
});
navwin1.open();
});
tabGroup.open();
You need to test this on iPhone 4. On faster phones, you need to increase number of elements in "createWin" function. In real app, we experienced this with iPhone 4, 4s and 5c (5s is fast enough, while we didn't test app with 5).
First, click on red window. Notice two things:
* vertical layout is slow (you can see all labels on top), it seems layout mechanism waits until window is opened
* left nav button shows default value first, then custom label
After that, check out second example by clicking Blue tab and clicking on that window. You should see white window of navigation window, then click on label to open new window in nav window. You should see same issues as with tab group.
For the layout part there is already a ticket: TIMOB-17923
Gracias amigo, will take a look :)