Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-16976] Android: Assigning View.right value isn't getting drawn on OrientationChange event

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionCannot Reproduce
Resolution Date2014-06-03T20:47:42.000+0000
Affected Version/sRelease 3.2.3
Fix Version/sRelease 3.4.0
ComponentsAndroid
Labelsmodule_animation, qe-testadded, supportTeam
ReporterEduardo Gomez
AssigneeHieu Pham
Created2014-05-16T23:02:42.000+0000
Updated2017-03-17T18:22:38.000+0000

Description

Issue description

When you position an element with the property "right" and any value assigned, then you change the orientation to, either portrait or landscape the property "right" value is not correctly updated. None of these issues existed before the upgrade to Titanium SDK 3.2.3.GA, and all of them are fixed if the SDK version is reverted to 3.2.2.GA with no other code changes.

Steps to replicate

The sideBar View is experiencing the following issues:

Starting in portrait, press 'Expand' to expand the side bar, then change orientation to landscape. Side bar is now stuck in the middle of the window (please see screen shoots attached demonstrating misplaced sideBar at 3.2.3.GA).

Starting in portrait, press 'Expand' and then 'Collapse' to collapse the side bar, then change orientation to landscape. The side bar is now visible again.

Starting in landscape, press 'Expand' and then reorient to portrait. The side bar is now off-screen (20% is shifted to the left).

Runnable Sample

var win = Ti.UI.createWindow({
	navBarHidden : true,
	backgroundColor : '#00f',
	width : Ti.UI.FILL,
	height : Ti.UI.FILL
});

var toggle = Ti.UI.createButton({
	top : 100,
	left : 10,
	title : 'Expand'
});
toggle.addEventListener('click', toggleSideBar);
win.add(toggle);

var sideBar = Ti.UI.createView({
	top : 0,
	right : -300,
	width : 300,
	height : Ti.UI.FILL,
	backgroundColor : 'pink',
	expanded : false
});

function toggleSideBar(e) {
	if (sideBar.expanded) {
		sideBar.animate({
			right : -300,
			duration : 400
		}, function() {
			sideBar.right = -300;
			sideBar.expanded = false;
			toggle.title = 'Expand';
		});
	} else {
		sideBar.animate({
			right : 0,
			duration : 400
		}, function() {
			sideBar.right = 0;
			sideBar.expanded = true;
			toggle.title = 'Collapse';
		});
	}
}

Ti.Gesture.addEventListener('orientationchange', function(e) {
	Ti.API.info(' #### OrientationChange sideBar.right: ' + sideBar.right);
	if (e.source.isLandscape() && sideBar.expanded) {
		sideBar.right = 0;
	} else if (e.source.isPortrait() && !sideBar.expanded) {
		sideBar.right = -300;
	}
});
win.add(sideBar);
win.open();

Attachments

FileDateSize
Device-3.2.2.GA.png2014-05-16T23:02:42.000+000026159
Device-3.2.3.GA.png2014-05-16T23:02:42.000+000044337

Comments

  1. Hieu Pham 2014-06-03

    Tested and this is working fine on lastest master. Resolving issue as unable to reproduce.
  2. Lee Morris 2017-03-17

    Closing ticket as the issue cannot be reproduced.

JSON Source