Description of the problem
When switching between views using animate, the operation works (back and forth) only once.
Steps to reproduce
Use the following code, switch to view 2, back to view 1, and again: it will only work once, then back to view1 it will not go anymore to view2.
function createView1() {
var view1 = Ti.UI.createView();
var btn1 = Ti.UI.createButton({
title: 'Switch to view2'
});
btn1.addEventListener('click', function() {
var view2 = createView2();
view1.animate({view: view2, transition: Ti.UI.iPhone.AnimationStyle.FLIP_FROM_LEFT});
});
view1.add(btn1);
return view1;
}
function createView2() {
var view2 = Ti.UI.createView();
var btn2 = Ti.UI.createButton({
title: 'Switch back to view1'
});
btn2.addEventListener('click', function() {
var view1 = createView1();
view2.animate({view: view1, transition: Ti.UI.iPhone.AnimationStyle.FLIP_FROM_LEFT});
});
view2.add(btn2);
return view2;
}
var view1 = createView1();
var win = Ti.UI.createWindow();
win.add(view1);
win.open();
Notes
The code sample above is re-creating the views all the times, as - according to the documentation - the view gets destroyed once the animation is over. In fact, if the views are not re-created, the app will crash trying to switch back.
Transition animation on views are to transition subviews of a View (In this case the window). Use this code instead
Closing ticket as invalid with reference to the above comments.