ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

Content's _scroll is undefined in a lot of cases

Open Manduro opened this issue 9 years ago • 9 comments

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

Manduro avatar Dec 12 '16 09:12 Manduro

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 avatar Dec 12 '16 20:12 jgw96

@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.

Manduro avatar Dec 13 '16 10:12 Manduro

hmm interesting. let me know what you find! Unfortunately i am still unable to repro this issue. Does your app use virtual scroll?

jgw96 avatar Dec 13 '16 16:12 jgw96

@jgw96 I will. No, it does not use virtual scroll.

Manduro avatar Dec 13 '16 17:12 Manduro

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.

pyavcom avatar Dec 15 '16 13:12 pyavcom

Still happening here on RC4. Seems to happen after closing a modal with inputs, sometimes.

Manduro avatar Jan 10 '17 14:01 Manduro

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",

Full trace

This is the code in referenced in the error:

selection_108

this._scrollEle.style.paddingBottom = (newPadding > 0) ? newPadding + 'px' : '';

_scrollEle is null?

g8d3 avatar Feb 05 '17 17:02 g8d3

This solved my issue for now:

setTimeout(()=>{this.nav.setPages([MyPage])}, 300)

g8d3 avatar Feb 06 '17 17:02 g8d3

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.

ionitron-bot[bot] avatar Sep 04 '18 07:09 ionitron-bot[bot]