ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

collection-repeat directive bug on Android 4.1

Open shivanik opened this issue 12 years ago • 7 comments

I tried this code pen code http://codepen.io/ionic/details/mFygh5on Nexus 4 (android 4.4) as well as on Samsung Galaxy S3 (android 4.1)....on the samsung phone, it seems to hang mid-way during the scroll. IT looks like some kind of bug. You can try cloning it from here: git clone https://gist.github.com/11531038.git

The logs show the following error when the list scroll hangs:

D/CordovaLog(20585): http://code.ionicframework.com/1.0.0-beta.3/js/ionic.bundle.js1: Line 32999 : Uncaught TypeError: Cannot set property 'webkitTransform' of undefined E/Web Console(20585): Uncaught TypeError: Cannot set property 'webkitTransform' of undefined:32999

shivanik avatar May 07 '14 00:05 shivanik

I have access to android 4.1 phone now, I will try to reproduce this.

ajoslin avatar May 09 '14 13:05 ajoslin

Hi, I found that the issue seems to be in IonicModule .factory('$collectionRepeatManager', [..) in the renderItem function where the item.element[0].style seems to be undefined in that case and then it gets Cannot set property 'webkitTransform' of undefined. So, just to work around that issue, I added:

diff --git a/www/lib/ionic/js/ionic.bundle.js b/www/lib/ionic/js/ionic.bundle.js index c5fd018..92cf8c8 100644 --- a/www/lib/ionic/js/ionic.bundle.js +++ b/www/lib/ionic/js/ionic.bundle.js @@ -38269,7 +38269,7 @@ function($rootScope, $timeout) { }, renderItem: function(dataIndex, primaryPos, secondaryPos) { var item = this.dataSource.getItem(dataIndex);

  •  if (item) {
    
  •  if (item && item.element[0].style) {
     this.dataSource.attachItem(item);
     item.element[0].style[ionic.CSS.TRANSFORM] = this.transformString(
       primaryPos, secondaryPos, secondaryPos
    
    @@ -44411,4 +44411,4 @@ IonicModule }; }]);

-})(); \ No newline at end of file +})();

This is not a proper fix but I don't hit the issue again and again now.

shivanik avatar May 12 '14 02:05 shivanik

Hi @shivanik,

I'm finally getting to this.

I still don't know why this bug is happening, but I will implement some failsafes like you suggest for now.

ajoslin avatar May 21 '14 13:05 ajoslin

It just uses the .css() function now, which has built in null checks.

ajoslin avatar May 21 '14 13:05 ajoslin

This still exists I have error "ionic.bundle.js: Line 4825 : Uncaught TypeError: Cannot set property 'WebkitTransform' of undefined" on 4.1 android but not 4.4 android.

stellasoft-will avatar Oct 22 '14 13:10 stellasoft-will

I got this problem sometime too. The scrolling got disabled. I can't inspect. Is the fix above integrated into the last version of ionic? Thanks

BapsiB avatar Sep 17 '15 16:09 BapsiB

getting this on samsung with android 4.1.2 after adding collection-repeat works well with ng-repeat.

clearride avatar Jan 10 '16 05:01 clearride