Ionic-framework: EXCEPTION: Cannot read property 'scrollToBottom' of null

Created on 1 Mar 2017  路  10Comments  路  Source: ionic-team/ionic-framework

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

I'm submitting a ... (check one with "x")
[ x] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/

Current behavior:

EXCEPTION: Cannot read property 'scrollToBottom' of null
t.handleError @ main.js:64970
e.handleError @ main.js:137256
next @ main.js:40916
e.object.i @ main.js:42426
e.__tryOrUnsub @ main.js:5548
e.next @ main.js:5497
e._next @ main.js:5450
e.next @ main.js:5414
e.next @ main.js:10136
e.emit @ main.js:42418
t.triggerError @ main.js:43268
onHandleError @ main.js:43247
t.handleError @ polyfills.js:3
e.runTask @ polyfills.js:3
invoke @ polyfills.js:3
e.args.(anonymous function) @ polyfills.js:2
main.js:64975 ORIGINAL STACKTRACE:
t.handleError @ main.js:64975
e.handleError @ main.js:137256
next @ main.js:40916
e.object.i @ main.js:42426
e.__tryOrUnsub @ main.js:5548
e.next @ main.js:5497
e._next @ main.js:5450
e.next @ main.js:5414
e.next @ main.js:10136
e.emit @ main.js:42418
t.triggerError @ main.js:43268
onHandleError @ main.js:43247
t.handleError @ polyfills.js:3
e.runTask @ polyfills.js:3
invoke @ polyfills.js:3
e.args.(anonymous function) @ polyfills.js:2
main.js:64976 TypeError: Cannot read property 'scrollToBottom' of null
    at e.scrollToBottom (http://local.xiv.im:8100/build/main.js:6:21965)
    at t.<anonymous> (http://local.xiv.im:8100/build/main.js:28:24792)
    at t.invokeTask (http://local.xiv.im:8100/build/polyfills.js:3:9723)
    at Object.onInvokeTask (http://local.xiv.im:8100/build/main.js:17:20009)
    at t.invokeTask (http://local.xiv.im:8100/build/polyfills.js:3:9659)
    at e.runTask (http://local.xiv.im:8100/build/polyfills.js:3:7083)
    at invoke (http://local.xiv.im:8100/build/polyfills.js:3:10836)
    at e.args.(anonymous function) (http://local.xiv.im:8100/build/polyfills.js:2:30123)
t.handleError @ main.js:64976
e.handleError @ main.js:137256
next @ main.js:40916
e.object.i @ main.js:42426
e.__tryOrUnsub @ main.js:5548
e.next @ main.js:5497
e._next @ main.js:5450
e.next @ main.js:5414
e.next @ main.js:10136
e.emit @ main.js:42418
t.triggerError @ main.js:43268
onHandleError @ main.js:43247
t.handleError @ polyfills.js:3
e.runTask @ polyfills.js:3
invoke @ polyfills.js:3
e.args.(anonymous function) @ polyfills.js:2

Expected behavior:
no such exception.

Steps to reproduce:

I have checked all positions where using scrollToBottom, and add xxx && xxx.scrollToBottom to avoid null objects, but it happens still.

Most helpful comment

@calidion I solved it with this fix:

if(this.content._scroll) this.content.scrollToBottom(0);

Hope it helps.

All 10 comments

Hello, thanks for opening an issue with us. Could your please provide a repro case? You can use this plunker as a template.

Hello all! As it seems it has been a while since there was any activity on this issue i will be closing it for now. Feel free to comment if you are still running into this issue. Thanks for using Ionic!

@jgw96
every easy to run into it again and again. but currently I can't figure out why.

@calidion I solved it with this fix:

if(this.content._scroll) this.content.scrollToBottom(0);

Hope it helps.

@pablo-albaladejo That solution worked perfectly. My problem is that the initialized view that has scrolling gets closed before the data is loaded. The _scroll property evaluates to null on this case and it was throwing the error.

@pablo-albaladejo Thanks, drove me crazy for days, owe you one.

Thank you so very much @pablo-albaladejo ! <3

@pablo-albaladejo Thanks! works like a charm!

@pablo-albaladejo Thank you

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

Was this page helpful?
0 / 5 - 0 ratings