Titanium JIRA Archive
Appcelerator Community (AC)

[AC-1881] iOS: Modal Window, wrong layout

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionCannot Reproduce
Resolution Date2013-04-18T17:37:35.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsios, layout, modal, navigationgroup
ReporterMartin Guillon
AssigneeMauro Parra-Miranda
Created2013-04-16T13:16:46.000+0000
Updated2016-03-08T07:40:48.000+0000

Description

*Steps to reproduce* If you run the test case you can see too things: - open close multiple times the modal window. You get wrong layout 1 / 2 - NavigationGroup: wrong layout adjustment on opening *Test case*
// by default the modal window has a nav bar
// since we're embedding a navgroup inside the modal
// window which also has a nav bar, we ask him to hide it
var currentwin = Ti.UI.createWindow({
	backgroundColor : "white"
});

var open = Ti.UI.createButton({
	title : 'Open nav group',
	top : 150,
	width : 200,
	height : 40
});
open.addEventListener('click', function() {
	modal.open({
		modal : true
	});
});
currentwin.add(open);

var modal = Ti.UI.createWindow({
	backgroundColor : 'black',
	navBarHidden : true
});

var modalWin = Ti.UI.createWindow({
	backgroundColor : "red"
});

var nav = Ti.UI.iPhone.createNavigationGroup({
	top : 0,
	bottom : 0,
	window : modalWin,
	backgroundColor : 'blue'
});

var table = Ti.UI.createTableView({
	top : 10,
	style : Ti.UI.iPhone.TableViewStyle.GROUPED,
	data : [{
		title : "Well look at this"
	}, {
		title : "TweetDeck is cool"
	}]
});
modalWin.add(table);
modalWin.add(Ti.UI.createView({
	bottom : 5,
	width : 100,
	height : 100,
	backgroundColor : 'blue'

}));

var done = Titanium.UI.createButton({
	systemButton : Titanium.UI.iPhone.SystemButton.DONE
});

modalWin.setRightNavButton(done);

done.addEventListener('click', function() {
	modal.close();
});

table.addEventListener('click', function(e) {
	var b = Titanium.UI.createButton({
		title : 'Back (no anim)',
		style : Titanium.UI.iPhone.SystemButtonStyle.BORDERED
	});
	b.addEventListener('click', function() {
		nav.close(w, {
			animated : false
		});
	});
	var w = Ti.UI.createWindow({
		title : e.rowData.title,
		rightNavButton : b
	});
	w.addEventListener('focus', function() {
		Ti.API.info("nav group window -- focus event");
	});
	w.addEventListener('blur', function() {
		Ti.API.info("nav group window -- blur event");
	});
	var b = Ti.UI.createButton({
		title : "Close Nav",
		width : 120,
		height : 40
	});
	b.addEventListener('click', function() {
		modal.close();
	});
	w.add(b);
	nav.open(w);
});

modal.add(nav);
// modal.open({modal:true});
currentwin.open();

Attachments

FileDateSize
31ga-modalwindow.png2013-04-17T23:50:01.000+000016280

Comments

  1. Martin Guillon 2013-04-16

    pull request https://github.com/appcelerator/titanium_mobile/pull/4170
  2. Daniel Sefton 2013-04-17

    Hi Martin, Please can you clarify what you mean by "wrong layout"? The fact that the red background shows, meaning the height of the modal view is not correct? Thanks.
  3. Martin Guillon 2013-04-18

    @Daniel: I am really confused, i cant reproduce it either on the master branch or even on 3.0.2.GA I was sure it was happening. This is really strange to me You can close it for now and i ll try and dig deep into this. I am really really sorry to have wasted your time Daniel.
  4. Daniel Sefton 2013-04-18

    No problem, I'll resolve as "Cannot Reproduce".

JSON Source