Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-13237] iOS: View - View.left does not work second time when animation is implemented on button click

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2013-05-15T20:41:06.000+0000
Affected Version/sRelease 3.1.0
Fix Version/s2013 Sprint 10 API, 2013 Sprint 10, Release 3.1.1, Release 3.2.0
ComponentsiOS
Labelsmodule_animation, qe-3.1.0, qe-closed-3.1.1, qe-testadded
ReporterAnshu Mittal
AssigneeVishal Duggal
Created2013-03-28T09:32:08.000+0000
Updated2013-09-20T20:36:23.000+0000

Description

View.left property does not work second time when animation is implemented on button click. This is not regression since the issue occurs on 3.0.2 GA but the issue DOES NOT occur on 3.0.0.GA Steps to reproduce: 1. Create an app using the code below. 2. Launch the app. 3. Click on 'Animate' button. The red view moves from left edge to right with animation. 4. Click on 'Animate' button again. Actual: The view remains at the right. So, no animation is noticed second time. Expected: The view should move to the left instantly and then should animate to the right.

var win1 = Titanium.UI.createWindow({  
    title:'Tab 1',
    backgroundColor:'white',
    fullscreen: true  
});


		//label using localization-ready strings from <app dir>/i18n/en/strings.xml
		var view = Ti.UI.createView({
		    backgroundColor:'red',
		    height:100,
		    width:100,
		    top:0,
		    left:0
		});
		win1.add(view);
		 
		var button = Titanium.UI.createButton({
		    title:'Animate',
		    width:200,
		    height:40,
		    bottom:20,
		    left: 10
		});
		 
		button.addEventListener('click', function()
		{
		    view.left = 0;
		   // view.updateLayout({left:0}); //tried that too, still doesnt work
		    view.animate({left:(win1.rect.width - view.rect.width), duration:1000});
		});
		win1.add(button);		 
		win1.open();
	

Comments

  1. Patrick Seda 2013-04-06

    Extending the behavior definition based upon other usage scenarios: 1) This is not limited to the "left" value of the view, e.g. "top" also does not work. 2) However, the "backgroundImage" and "backgroundColor" parameters WILL behave properly. 3) There is some latency issue present. i.e. Delaying the animation after changing the properties enables correct behavior, demonstrated by this modification to the reporter's sample code:
       setTimeout(function() {
       	view.animate({left:(win1.rect.width - view.rect.width), duration:1000});
       }, 500);
       
  2. Blain Hamon 2013-05-07

    This is because we coalesce view updates in LayoutQueue.m. If we have the animations wait in that same line similarly, this would work.
  3. Vishal Duggal 2013-05-10

    Pull pending against master https://github.com/appcelerator/titanium_mobile/pull/4250
  4. Vishal Duggal 2013-05-15

    Backport PR to 3_1_X https://github.com/appcelerator/titanium_mobile/pull/4272
  5. Federico Casali 2013-05-31

    Verified as fixed on iPhone 5 6.1.4 Environment: Appcelerator Studio 3.1.1.201305312408 Titanium SDK 3.1.1.v20130530204550 Alloy 1.1.3-alpha Titanium-Code-Processor 1.1.3-alpha4 Closing.

JSON Source