Skip to content

issue - scrolling on device : scroll to top #5810

Closed

Description

@dylanvdmerwe

Short description of the problem:

It would be great to be able to programatically move an ion-list scroll position. For example: scrollToTop() or scrollToBottom() methods.

What behavior are you expecting?

Especially on Android, after the keyboard is open, the padding added to the bottom of the screen does not go away (this may be a bug?). As such, I sometimes need to scroll the screen back to the top as the scrolling position is whack.

Which Ionic Version? 2.x

** Platforms: All

Activity

  1. jgw96 commented on Mar 11, 2016

    @jgw96
    Contributor

    Hello, thanks for submitting your issue! Would you be able to provide some code (repo, codepen etc) so that we can repro the issue? Also would you mind running ionic info and pasting the content here?

  2. dylanvdmerwe commented on Mar 11, 2016

    @dylanvdmerwe
    ContributorAuthor

    Alright here is an example to run on an Android device. Have yet to try this on iOS.

    On the device, press one of the lower ion-inputs. The keyboard should open up and the ion-list will scroll so that the image is not visible. When you hide the keyboard, the content does not return to it's original position. If I press the Next button and the div's swap, you'll see why I want a scrollToTop() function to fix the ion-list scroll position.

    Ultimately it would be best for the padding to go away back to how it was after the keyboard is dismissed.

    TS

    export class Page1 {
        swap : boolean;
    
        next() {
            this.swap = !this.swap;
        }
    }
    

    HTML

    <ion-navbar *navbar>
        <ion-title>Tab 1</ion-title>
    </ion-navbar>
    
    <ion-content>
        <ion-list>
            <img src='https://www.google.co.za/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png' style='width:80%; margin-bottom:50px'>
            <div [hidden]='swap'>
                <form>
                    <ion-item>
                        <ion-label>University</ion-label>
                        <ion-input type='text' placeholder='Enter your course'></ion-input>
                    </ion-item>
                    <ion-item>
                        <ion-label>University</ion-label>
                        <ion-input type='text' placeholder='Enter your course'></ion-input>
                    </ion-item>
                    <ion-item>
                        <ion-label>University</ion-label>
                        <ion-input type='text' placeholder='Enter your course'></ion-input>
                    </ion-item>
                    <ion-item>
                        <ion-label>University</ion-label>
                        <ion-input type='text' placeholder='Enter your course'></ion-input>
                    </ion-item>
                </form>
            </div>
            <div [hidden]='!swap'>
                <h1>test</h1>
            </div>
            <button (click)='next()'>Next</button>
        </ion-list>
    </ion-content>
    

    Cordova CLI: 6.0.0
    Ionic Version: 2.0.0-beta.3
    Ionic CLI Version: 2.0.0-beta.19
    Ionic App Lib Version: 2.0.0-beta.9
    OS:
    Node Version: v5.3.0

  3. assigned and unassigned on Mar 11, 2016
  4. changed the title [-]feat(ion-list) : scroll to top[/-] [+]issue - scrolling on device : scroll to top[/+] on Mar 11, 2016
  5. dylanvdmerwe commented on Mar 11, 2016

    @dylanvdmerwe
    ContributorAuthor

    I think #5536 is also referring to the same issue.

  6. added this to the 2.0.0-beta.5 milestone on Apr 2, 2016
  7. EvanWillms commented on Apr 10, 2016

    @EvanWillms

    I'm tagging reports of the keyboard padding overstaying its welcome back to #5432 as a canonical issue.

    This thread still has the initial feature request outstanding.

  8. adamdbradley commented on Apr 12, 2016

    @adamdbradley
    Contributor
  9. nunoarruda commented on Apr 18, 2016

    @nunoarruda
    Contributor

    No love for scrollToBottom() ? It would handy in my current Ionic project.

  10. dylanvdmerwe commented on Apr 19, 2016

    @dylanvdmerwe
    ContributorAuthor
  11. nunoarruda commented on Apr 19, 2016

    @nunoarruda
    Contributor

    @dylanvdmerwe yeah, Adam notified me after making that commit. Thanks anyway!

  12. locked and limited conversation to collaborators on Sep 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions