File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -110,6 +110,13 @@ var InfiniteScroll = (function(_Component) {
110110 {
111111 key : 'componentDidUpdate' ,
112112 value : function componentDidUpdate ( ) {
113+ if ( this . props . isReverse ) {
114+ var parentElement = this . getParentElement ( this . scrollComponent ) ;
115+ parentElement . scrollTop =
116+ parentElement . scrollHeight -
117+ this . beforeScrollHeight +
118+ this . beforeScrollTop ;
119+ }
113120 this . attachScrollListener ( ) ;
114121 } ,
115122 } ,
@@ -261,6 +268,8 @@ var InfiniteScroll = (function(_Component) {
261268 el . offsetParent !== null
262269 ) {
263270 this . detachScrollListener ( ) ;
271+ this . beforeScrollHeight = parentNode . scrollHeight ;
272+ this . beforeScrollTop = parentNode . scrollTop ;
264273 // Call loadMore after detachScrollListener to allow for non-async loadMore functions
265274 if ( typeof this . props . loadMore === 'function' ) {
266275 this . props . loadMore ( ( this . pageLoaded += 1 ) ) ;
Original file line number Diff line number Diff line change @@ -44,6 +44,13 @@ export default class InfiniteScroll extends Component {
4444 }
4545
4646 componentDidUpdate ( ) {
47+ if ( this . props . isReverse ) {
48+ const parentElement = this . getParentElement ( this . scrollComponent ) ;
49+ parentElement . scrollTop =
50+ parentElement . scrollHeight -
51+ this . beforeScrollHeight +
52+ this . beforeScrollTop ;
53+ }
4754 this . attachScrollListener ( ) ;
4855 }
4956
@@ -172,6 +179,8 @@ export default class InfiniteScroll extends Component {
172179 ( el && el . offsetParent !== null )
173180 ) {
174181 this . detachScrollListener ( ) ;
182+ this . beforeScrollHeight = parentNode . scrollHeight ;
183+ this . beforeScrollTop = parentNode . scrollTop ;
175184 // Call loadMore after detachScrollListener to allow for non-async loadMore functions
176185 if ( typeof this . props . loadMore === 'function' ) {
177186 this . props . loadMore ( ( this . pageLoaded += 1 ) ) ;
You can’t perform that action at this time.
0 commit comments