Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-12636] MobileWeb: Incorrect Ti.UI.View width calculation

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionWon't Fix
Resolution Date2017-06-26T22:14:06.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsMobileWeb
Labelsn/a
ReporterYaroslav Pidstryhach
AssigneeUnknown
Created2012-11-26T13:47:11.000+0000
Updated2018-04-04T23:20:16.000+0000

Description

Consider the following Titanium code:
	var view = Ti.UI.createView({
		height : 200,
		width : 200,
		backgroundColor : 'yellow'
	});

	var viewChild = Ti.UI.createView({
		backgroundColor : 'red',
		center : {
			x : 100
		},
		right : 50
	});

	view.add(viewChild);

	var win = Ti.UI.createWindow();
	win.add(view);

	win.open();

	view.addEventListener('postlayout', function() {
		Ti.API.info(" POST_LAYOUT: the width of view should be 200: " + view.size.width);
		Ti.API.info(" POST_LAYOUT: the width of viewChild should be 100: " + viewChild.size.width);
	});

	Ti.API.info(" Expected: the width of view should be 200: " + view.size.width);
	Ti.API.info(" Expected: the width of viewChild should be 100: " + viewChild.size.width); 

	//Simulator iOS 6 output
	//[INFO] :  Expected: the width of view should be 200: 200
	//[INFO] :  Expected: the width of viewChild should be 100: 100

Expected

the width of viewChild should be 100. (The width should be calculated as: ((viewChild.center(100) - viewChild.right(50)) * 2), according to "http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.UI.View-property-layout")

Actual

The width of viewChild is 150

tested on

FireFox 18.0.2
[INFO] POST_LAYOUT: the width of view should be 200: 200

index.html (line 2024)
info:

[INFO] POST_LAYOUT: the width of viewChild should be 100: 150

Comments

  1. Lee Morris 2017-06-26

    Resolving as "Won't Fix" as MobileWeb has been deprecated.
  2. Eric Merriman 2018-04-04

    Closing as will not fix.

JSON Source