View Full Version : [DUP] Animations doesn't work in packaged iOS application

11 Nov 2011, 3:03 AM
I was trying to package a sencha touch 2 app into a ios app using the phonegap packaging and I've found a couple of problems.

The first one is I can't use the Ext.application initialization, if I use it, the launch method is not executed and only what I get is a white screen. I've solved it using the new Ext.Application instead.

The other one, is the animations doesn't work at all! If I set any animation or use a widget that use it, the app stop working.
Debugging a little I've found (by chance, more than anything else) an issue that only occur in the WebView of the iphone (Im using the emulator, not phisical) If I use the default browser all it's ok.

The thing is in getTestElement method of Ext.fx.runner.CssTransition

getTestElement: function() {
var testElement = this.testElement,
iframe, iframeDocument, iframeStyle;

if (!testElement) {
iframe = document.createElement('iframe');
iframeStyle = iframe.style;
iframeStyle.visibility = 'hidden !important';
iframeStyle.width = '0px !important';
iframeStyle.height = '0px !important';
iframeStyle.position = 'absolute !important';
iframeStyle.zIndex = '-1000 !important';

iframeDocument = iframe.contentDocument;

this.testElement = testElement = iframeDocument.createElement('div');
testElement.style.position = 'absolute !important';
this.testElementComputedStyle = window.getComputedStyle(testElement);

return testElement;

The problem is with the line iframeDocument.body.appendChild(testElement)
I've detected that in the ios WebView the iframeDocument.body is null so you get a null exception when that code is executed. In order to solve it, I put a line before:

iframeDocument.body = document.createElement('body');

Then the animations start working sucessfully.

Anybody are using senchatouch 2 to package a native ios application? For me was too hard to get it work.

11 Nov 2011, 6:36 PM
Thank you for this info and doing some debugging. I will send this to the core devs to see what they can do to alleviate this.

14 Nov 2011, 11:09 AM
Just an update, we have decided to push up as a bug!