Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ios): do not update properties if transition animation #12028

Merged
merged 1 commit into from
Sep 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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