Skip to content

Commit

Permalink
fix(ios): animating view width/height from zero
Browse files Browse the repository at this point in the history
Fixes TIMOB-27236
  • Loading branch information
jquick-axway authored and sgtcoolguy committed Jun 14, 2021
1 parent 4914dca commit df7c106
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
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);
}

- (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

0 comments on commit df7c106

Please sign in to comment.