ionic-team / ionic-framework

A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.
https://ionicframework.com
MIT License
51.09k stars 13.51k forks source link

Bug: Virtual scroll scrollToTop not found when I called this.content.scrollToBottom() #13275

Closed MrBokeh closed 5 years ago

MrBokeh commented 7 years ago

Ionic version: (check one with "x") [ ] 2.x [x ] 3.x [ ] 4.x

I'm submitting a ... (check one with "x") [x ] bug report [ ] feature request

Current behavior: _co.ScrollToTop not found on virtual scroll

Expected behavior: It should scroll to the bottom if I called this.content.scrollToBottom()

Steps to reproduce: 1) use Virtual Scoll 2) Call the this.content.scrollToBottom() to scroll the page to the bottom

Related code:

this.content.scrollToBottom();

Other information: N/A

Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):

cli packages: (/usr/local/lib/node_modules)

    @ionic/cli-utils  : 1.15.2
    ionic (Ionic CLI) : 3.15.2

global packages:

    cordova (Cordova CLI) : 7.1.0 

local packages:

    @ionic/app-scripts : 3.0.1
    Cordova Platforms  : android 6.3.0 browser 5.0.1 ios 4.2.0
    Ionic Framework    : ionic-angular 3.8.0

System:

    ios-deploy : 1.9.2 
    Node       : v8.7.0
    npm        : 5.4.2 
    OS         : macOS Sierra
    Xcode      : Xcode 9.0.1 Build version 9A1004 

Environment Variables:

    ANDROID_HOME : not set

Misc:

    backend : legacy
kensodemann commented 7 years ago

Hello! Thank you for opening an issue with us! Would you be able to provide a sample application via GitHub that demonstrates the issue you are having? Thanks for using Ionic!

MrBokeh commented 7 years ago

Hi @kensodemann there you go: https://github.com/MrBokeh/VirtualScrollSampleApp/ or https://github.com/MrBokeh/VirtualScrollSampleApp/blob/master/src/pages/home/home.ts

I am building a chat app which need to auto scroll to the bottom whenever user sent a message or someone else sent a message so that's why I need to scroll to the bottom for the list.

MrBokeh commented 7 years ago

@kensodemann I am suspecting that if the items total height is less than the screen height then this problem will occur.

kensodemann commented 7 years ago

Duplicated. Marked as Virtual Scroll issue, and set to review after v4 is released.

ghenry22 commented 7 years ago

Virtualscroll has known issues with scrollTo functions (be it top, bottom or co-ords) there have been tickets open for a long time for these.

WKWebview helps resolve some but then it also creates some of its own. For example hitting a scrollToTop, Bottom etc while the view is scrolling will stop the current scroll but completely disregard the scrollTo request.

ionitron-bot[bot] commented 5 years ago

Thanks for the issue! We have moved the source code and issues for Ionic 3 into a separate repository. I am moving this issue to the repository for Ionic 3. Please track this issue over there.

Thank you for using Ionic!

ionitron-bot[bot] commented 5 years ago

Issue moved to: https://github.com/ionic-team/ionic-v3/issues/832