scrollView.scrollTo error, happens very frequently


#1

I have error reporting in one of my apps and this error happens a lot.

I have this markup layout and some back end code working out whether more items are available in items2 (items1 is a fixed length and doesn’t use infinite loading)…

<ion-content>
  <ion-scroll>
     <div ng-repeat="item in items1 track by item.id"></div>
     <div ng-repeat="item in items2 track by item.id"></div>
     <ion-infinite-scroll ng-if="itemsAvailable" on-infinite="loadMore()" distance="1%" style="height: 0;" immediate-check="false"></ion-infinite-scroll>
  </ion-scroll>
</ion-content>

TypeError: null is not an object (evaluating ‘scrollView.scrollTo’)

Time on app: 3/8/2016 3:27:32 PM

Message: TypeError: null is not an object (evaluating ‘scrollView.scrollTo’)

Stacktrace:
• - file:///var/mobile/Containers/Bundle/Application/DAB74190-026C-4045-B929-9E7B38CB2E0F/Adnams%20Sales.app/www/lib/ionic/js/ ionic.bundle.js:52923:17
• - processQueue@file:///var/mobile/Containers/Bundle/Application/DAB74190-026C-4045-B929-9E7B38CB2E0F/Adnams%20Sales.app/www/lib/ionic/js/ionic.bundle.js:23394:30
• - file:///var/mobile/Containers/Bundle/Application/DAB74190-026C-4045-B929-9E7B38CB2E0F/Adnams%20Sales.app/www/lib/ionic/js/ionic.bundle.js:23410:39
• - completeOutstandingRequest@file:///var/mobile/Containers/Bundle/Application/DAB74190-026C-4045-B929-9E7B38CB2E0F/Adnams%20Sales.app/www/lib/ionic/js/ionic.bundle.js:14221:15
• - file:///var/mobile/Containers/Bundle/Application/DAB74190-026C-4045-B929-9E7B38CB2E0F/Adnams%20Sales.app/www/lib/ionic/js/ionic.bundle.js:14493:33


#2

@mbrookson I am having the exact same error. Were you able to fix it?


#3

No not yet but it appears to happen on this line…

self.scrollTop = function(shouldAnimate) {
    self.resize().then(function() {
      scrollView.scrollTo(0, 0, !!shouldAnimate);  // <-- HERE
    });
  };

I feel like it might a container is somehow trying to scroll to the top before a page has finished rendering the DOM or something and therefore the scrollView object might not exist. Can’t quite work out a solution yet though.

It’s using ionic lib v1.1.0