Content's _scroll is undefined in a lot of cases
Note: This is a continuation of issues #9278 and #9310.
Ionic version: (check one with "x") [ ] 1.x [x] 2.x: 2.0.0-rc.3-201612100458
I'm submitting a ... (check one with "x") [x] bug report [ ] feature request [ ] support request
Current behavior: I'm getting a lot of these errors since RC3, and they are still there in the latest nightly:
TypeError: null is not an object (evaluating 'this._scroll.init')
File ".../main.js" line 4 col 25118 in readDimensions
TypeError: null is not an object (evaluating 'this._scroll.ev')
File ".../main.js" line 4 col 24256 in readDimensions
TypeError: null is not an object (evaluating 'this._scroll.scrollToBottom')
File ".../main.js" line 4 col 29595 in scrollToBottom
TypeError: null is not an object (evaluating 'this._scrollEle.style')
File ".../main.js" line 4 col 29911 in setScrollElementStyle
TypeError: null is not an object (evaluating 'this._scrollEle.style')
File ".../main.js" line 4 col 30395 in addScrollPadding
TypeError: Cannot read property 'style' of null
File ".../main.js" line 15025 col 28 in Content.addScrollPadding
TypeError: Cannot read property 'style' of null
File ".../main.js" line 4 col 20082 in e.setScrollElementStyle
TypeError: null is not an object (evaluating 'this._scroll.scrollToBottom')
File ".../main.js" line 4 col 19766 in scrollToBottom
Expected behavior:
_scroll should not be undefined or null when used.
Steps to reproduce:
I'm not able to reproduce this unfortunately. It seems to be a race condition only occurring in production builds, where Content's _scroll is not initialised before use.
My error reporting says these errors are only occurring on iOS.
Other information: Related issues: #9278 #9310
Ionic info:
Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.3-201612100458
Ionic CLI Version: 2.1.17
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 0.0.46
ios-deploy version: 1.9.0
ios-sim version: 5.0.12
OS: macOS Sierra
Node Version: v6.9.1
Xcode version: Xcode 8.1 Build version 8B62
Hello, thanks for posting an issue! Unfortunately i cannot reproduce this in my test apps. Could you post a repo i can use to try to repro this issue?
@jgw96 Like I said, I can't reproduce this either, unfortunately. But I'll keep looking into this.
The error logs for this issue are only coming from iOS users, not from web or Android. So at least that's some clue. It has been logged about 500 times for some 150 test users in ~24 hours, so it occurs quite often, but inconsistently.
hmm interesting. let me know what you find! Unfortunately i am still unable to repro this issue. Does your app use virtual scroll?
@jgw96 I will. No, it does not use virtual scroll.
TypeError: null is not an object (evaluating 'this._scrollEle.style')
happens at: this.nav.setRoot(SignupPage);
when change one page to other, and again change root back, and both pages has centered card and input fields on it, and card scrolls when keyboard appear authomaticaly.
Still happening here on RC4. Seems to happen after closing a modal with inputs, sometimes.
I am getting this in latest versions as for Feb 5 2017. I tested on Android device.
Error: cannot read property style of null
The code that produces it:
this.nav.setPages([MyPage])
It does go to that page, but after a few seconds error appears.
Error happens when I go to that page:
camera -> a form with picked image -> mypage
But it does not happen when:
gallery -> a form with picked image -> mypage
ionic -v
2.2.1
In package.json: "@ionic/app-scripts": "^1.0.0",
This is the code in referenced in the error:

this._scrollEle.style.paddingBottom = (newPadding > 0) ? newPadding + 'px' : '';
_scrollEle is null?
This solved my issue for now:
setTimeout(()=>{this.nav.setPages([MyPage])}, 300)
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.