Skip to content

Commit

Permalink
fix(ios): do not update properties if transition animation (#12028)
Browse files Browse the repository at this point in the history
  • Loading branch information
vijaysingh-axway committed Sep 10, 2020
1 parent ab87f2e commit 4a835fd
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion iphone/TitaniumKit/TitaniumKit/Sources/API/TiAnimation.m
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ - (void)animationCompleted:(NSString *)animationID finished:(NSNumber *)finished

// Update the modified properties on the view!
if (animatedViewProxy != nil) {
if (!isReverse && ![autoreverse boolValue] && properties != nil) {
if (!isReverse && ![self isTransitionAnimation] && ![autoreverse boolValue] && properties != nil) {
[animatedViewProxy applyProperties:properties];
}
// TODO: What about center?
Expand Down
32 changes: 32 additions & 0 deletions tests/Resources/ti.ui.view.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,38 @@ describe('Titanium.UI.View', function () {
win.open();
});

it.ios('animate (transition) - FLIP (app should not crash)', function (finish) {
win = Ti.UI.createWindow();
const controlView = Ti.UI.createView({
backgroundColor: 'red',
width: 100, height: 100,
left: 100, top: 100
});

win.addEventListener('open', function () {
const view = Ti.UI.createView({
top: 150,
left: 150,
width: 150,
height: 150,
backgroundColor: 'green'
});
controlView.add(view);
try {
controlView.animate({
view: view,
backgroundColor: 'green',
transition: Ti.UI.iOS.AnimationStyle.FLIP_FROM_LEFT
});
} catch (err) {
return finish(err);
}
finish();
});
win.add(controlView);
win.open();
});

// FIXME: I think there's a parity issue here!
// Android returns x/y values as pixels *always*. while the input '100' uses the default unit (dip)
// which may vary based on screen density (Ti.Platform.DisplayCaps.ydpi) - so may be 100 or 200 pixels!
Expand Down

0 comments on commit 4a835fd

Please sign in to comment.