Android list going top and transitions slow


#1

Hello guys, I uploaded a video where you can see when I scroll to an item then touch the
"Back button", the list goes to top, the scroll is not returning os it’s position.

Another issue, my transitions are very slow and not smooth like on iOS, I’m using a Moto G with Android Lollipop.

See the video on youtube: https://www.youtube.com/watch?v=vsFDJEcfRkU&feature=youtu.be


#2

Hi @lucassimines

I had similar issues and what really improved performance on my android app is the native scrolling

put this code inside your app.js within " .config "

if(!ionic.Platform.isIOS())$ionicConfigProvider.scrolling.jsScrolling(false);

I hope it helps you like helped me :smile:


#3

Hi @drodrigo, thanks for answering,

I added this code before, and experienced that the scroll position going to top is caused by this native scrolling. btw I think I don’t need to put this code now using the latest ionic version, but I added it again in my code and it’s stayed the same :/, my app is still going to top when going back.


#4

Yes, this seems to be an issue with ionic.
I was experiencing the same problem and i fixed it manually with javascript, like this:

var e = document.getElementById("ionicContentID");


$scope.$on("$ionicView.beforeEnter", function() {

    $timeout(function() {

     if(e.scrollHeight>=$rootScope.currentScrollPosition)
     $ionicScrollDelegate.scrollTo(0, $rootScope.currentScrollPosition);
        
    });

});

$scope.setScroll = function() {
    console.log('offsetHeight',e.scrollHeight);
    console.log('window.innerHeight = ',window.innerHeight);

    if(e.scrollTop!=0){
        $rootScope.currentScrollPosition= e.scrollTop;

    }
    
};

template looks like this:

<ion-content on-scroll="setScroll();" id="ionicContentID" has-footer="true"  class="has-tabs-top has-header" overflow-scroll="true"><div ng-include="currentTemplate"></div></ion-content>

Hope this helps.


#5

Hello @panospcm, thanks for answering,

When I put this code inside my .config I get the following errors:


#6

What is .config?
You should put the code inside the controller function.


#7

I mean my app.config, I’ll try to put inside the controller


#8

I put the code now inside the controller, but the scroll is still returning to top and I’m experiencing the following:


#9

Btw, I removed those codes and it’s working on Android using the chrome web, and on Android emulator, I don’t know why it’s not working on Ionic app for android when I upload my app, maybe is data or cache? Or I could send a new version to Google Play. Thanks for help!