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): animating view width/height from zero #12832

Merged
merged 3 commits into from
Jun 14, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 1 addition & 2 deletions iphone/TitaniumKit/TitaniumKit/Sources/API/TiViewProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -1318,8 +1318,7 @@ - (BOOL)viewInitialized

- (BOOL)viewReady
{
return view != nil && !CGRectIsEmpty(view.bounds) && !CGRectIsNull(view.bounds) &&
[view superview] != nil;
return (view != nil) && ([view superview] != nil);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just me being super nitpicky, but the brackets are not really required here.

}

- (BOOL)windowHasOpened
Expand Down
25 changes: 25 additions & 0 deletions tests/Resources/ti.ui.view.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,31 @@ describe('Titanium.UI.View', function () {
win.open();
});

// On iOS, the animation's 'complete' event used to never fire. See: TIMOB-27236
it('animate width/height from zero', function (finish) {
win = Ti.UI.createWindow({ backgroundColor: 'white' });
const view = Ti.UI.createView({
backgroundColor: 'orange',
top: 0,
left: 0,
width: 0,
height: 0,
});
win.add(view);
win.addEventListener('open', () => {
const animation = Ti.UI.createAnimation({
duration: 250,
width: win.size.width,
height: win.size.height,
});
animation.addEventListener('complete', () => {
finish();
});
view.animate(animation);
});
win.open();
});

it.windowsBroken('convertPointToView', function (finish) {
win = Ti.UI.createWindow();
const a = Ti.UI.createView({ backgroundColor: 'red' });
Expand Down