Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/react-chatview.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,12 @@ export default class ChatView extends Component {
this.scrollTop = this.scrollable.scrollTop;
this.scrollHeight = this.scrollable.scrollHeight;

//Pin scroll position when new children are coming if user is not at bottom or top
let userIsAtBottom = this.scrollable.scrollHeight - this.scrollable.scrollTop === this.scrollable.clientHeight;
if(!userIsAtBottom && this.props.shouldTriggerLoad()){
this.scrollable.scrollTop = newScrollTop + scrollHeightDifference;
}

// Setting scrollTop can halt user scrolling (and disables hardware acceleration)

// Both cases - flipped and refular - have cases where the content expands in the proper direction,
Expand Down