Cannot read property scrollToBottom of null after revisiting a page

cannot read property 'scrolltobottom' of undefined ionic
ionic 4 scroll to bottom
cannot read property 'scrollto' of undefined
scrolltobottom ionic 3
ionic 4 scroll to element
Your system information:

Cordova CLI: 6.4.0

Ionic Framework Version: 2.0.0-rc.4

Ionic CLI Version: 2.1.14

Ionic App Lib Version: 2.1.7

Ionic App Scripts Version: 0.0.47

ios-deploy version: Not installed

ios-sim version: Not installed

OS: Windows 7

Node Version: v6.9.2

Xcode version: Not installed

Im getting this error after Im pushing to a Conversation-View. With socketIO im connecting to my messageserver which is pushing new messages to the client. After this I want to automatically scroll down, so the newest message will be displayed.

If i open the conv.-window for the first time im good with it and all is working fine, but on the second time (pressing back and renavigating to the page) i got this error.

Thank you :)

EDIT: Error-Message:

Cannot read property scrollToBottom of null

connect() {
  this.socket.on("connect", () => {
      console.log("connected");  
      console.log("Listening on: "+"message_"+this.secretid);
      this.socket.emit('message', { type: "token", token: this.secretid });
      this.socket.on("message_"+this.secretid, (msg) => {
          let msg_data = JSON.parse(msg);
          msg_data.payload.writer_id = msg_data.payload.user;
          console.log(msg_data);
          this.chat.push(msg_data.payload);
          this.content.scrollToBottom(); <<--Error
      });
  });
}

Connect is called in ionViewDidLoad() {} so this.content should be initialized.

Im using ionic 2

EDIT 2: Only getting this error in Ionic Lab

ionviewdidload lifecycle hook is called for page initialisation and is called once. Docs here

The view may not be loaded yet.

From the given code,the solution I see is either put the scrollTobottom call in ionviewWillEnter

or try Angular's hook ngOnChanges Here where you can check for change in chat list.

EXCEPTION: Cannot read property 'scrollToBottom' of null � Issue , EXCEPTION: Cannot read property 'scrollToBottom' of null #10601 As it seems it has been a while since there was any activity on this issue i� 0 Cannot read property scrollToBottom of null after revisiting a page Jan 1 '17-1 How to edit Canvas-Objects appearance? Mar 18 '16. Badges

Try this:

<ion-content #content>
</ion-content>

Cannot read property 'scrollToBottom' of undefined � Issue #14098 , Ionic version: (check one with "x") (For Ionic 1.x issues, please use https://github. com/ionic-team/ionic-v1) [ ] 2.x [ ] 3.x [ ] 4.x I'm submitting a . infinnie changed the title 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 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

You need to put your this.content.scrollToBottom(0); under if condition. Like this :

if( this.content._scroll ) {

this.content.scrollToBottom(0);

}

Please try it once.

Cannot read property 'scrollToBottom' of undefined” - ionic-v3, I am getting this error “Cannot read property 'scrollToBottom' of undefined” and haven't got I have a custom accordion list, and on click of one of the list (since it will have some from '@ionic-native/native-storage'; @Component({ selector: ' page-profile', templateUrl: maxHeight = null; } else { panel.style. @matvp91 is correct, the element you're querying isn't rendered when you call getElementById so it returns null, and then throws because you try to access scrollTop and scrollLeft on null. You can either use a ref or query for the elements in useEffect , which is executed after the DOM is updated.

Ionic 2 getComponent alternative - typescript - Python, Cannot read property scrollToBottom of null after revisiting a page. Your system information: Cordova CLI: 6.4.0 Ionic Framework Version: 2.0.0-rc.4 Ionic CLI� smmalmansoori changed the title [jQuery] Cannot read property 'scrollTop' of undefined Cannot read property 'scrollTop' of undefined when using jQuery Apr 25, 2015 This comment has been minimized. Sign in to view

setRoot does not work after using SDK - ionic2 - Python, Cannot read property scrollToBottom of null after revisiting a page. Your system information: Cordova CLI: 6.4.0 Ionic Framework Version: 2.0.0-rc.4 Ionic CLI� 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

No se puede leer la propiedad scrollToBottom de null despu�s de , Informaci�n del sistema: Cordova CLI: 6.4.0Ionic Framework Version: 2.0.0-rc. 4Ionic CLI versi�n: 2.1.14Ionic App Lib versi�n: 2.1.7Ionic App Scripts versi�n:� Hi all I have an already existing Flow, just some minutes ago I opened it to add a new action block, but I can't since Flow editor is showing the following error: It's a bit difficult for me to share screenshots of the flow logic since it is a bit complex (more than 10 action blocks, 2 conditions

Comments
  • what is content and where is it saet?
  • @ViewChild(Content) content:Content; --> <ion-content></ion-content>
  • I could be more specific based on the code you can show
  • While this code may answer the question, providing additional context regarding why and/or how this code answers the question improves its long-term value. :)