Ionic-framework: Error: “Cannot read property 'style' of null” when going back from a page with the hardware back button where opening the keyboard has triggered the page to scroll

Created on 22 Nov 2016  ·  8Comments  ·  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:

If the page has to scroll to make the current form field visible when opening the keyboard, then when dismissing the keyboard and popping the page with the hardware back button, an error would be thrown that goes: “Cannot read property 'style' of null.”

Expected behavior:

No error would be thrown.

Most helpful comment

Hello all! Thanks for opening an issue with us. We are currently making alot of improvements around input scrolling which should fix this issue. I am testing these changes as we speak and will update this issue with my findings.

All 8 comments

Having the same error after updating to Ionic RC-3

Hello all! Thanks for opening an issue with us. We are currently making alot of improvements around input scrolling which should fix this issue. I am testing these changes as we speak and will update this issue with my findings.

Related or same: #9310

I'm still seeing these errors using the latest nightly 2.0.0-rc.3-201612021933, so the recent scroll changes haven't fixed this.

@adamdbradley Thanks! I'm not sure if this fixes all cases of this error though. I've logged the following ones:

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

any one know how to fix this? TypeError: Cannot read property 'style' of null

@AltRoot17 i'm experiencing this with ionic3 and Item reorder TypeError: Cannot read property 'style' of undefined at ItemReorder._reorderMove (http://localhost:8100/build/main.js:71606:33) at ItemReorderGesture.onDragMove (http://localhost:8100/build/main.js:166579:38) .. in my case the problem was that i had two reorder="true" in same view.. after i fixed it .. worked

This is causing the app to hang when its loaded for this first time. Any fixes on this

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