function topPosition(domElt) {
  if (!domElt) {
    return 0;
  }
  return domElt.offsetTop + topPosition(domElt.offsetParent);
}

module.exports = function (React) {
  if (React.addons && React.addons.InfiniteScroll) {
    return React.addons.InfiniteScroll;
  }
  React.addons = React.addons || {};
  var InfiniteScroll = React.addons.InfiniteScroll = React.createClass({
    getDefaultProps: function () {
      return {
        pageStart: 0,
        hasMore: false,
        loadMore: function () {},
        threshold: 250,
        loader: InfiniteScroll._defaultLoader
      };
    },
    getInitialState: function () {
      this.pageLoaded = this.props.pageStart;
    },
    componentDidMount: function () {
      this.attachScrollListener();
    },
    componentDidUpdate: function () {
      this.attachScrollListener();
    },
    render: function () {
      var props = this.props;
      return React.DOM.div(null, props.children, props.hasMore && props.loader);
    },
    scrollListener: function () {
      var el = this.getDOMNode();
      var scrollTop = (window.pageYOffset !== undefined) ? window.pageYOffset : (document.documentElement || document.body.parentNode || document.body).scrollTop;
      if (topPosition(el) + el.offsetHeight - scrollTop - window.innerHeight < Number(this.props.threshold)) {
        this.props.loadMore(this.pageLoaded += 1);
        this.detachScrollListener();
      }
    },
    attachScrollListener: function () {
      if (!this.props.hasMore) {
        return;
      }
      window.addEventListener('scroll', this.scrollListener);
      this.scrollListener();
    },
    detachScrollListener: function () {
      window.removeEventListener('scroll', this.scrollListener);
    },
    componentWillUnmount: function () {
      this.detachScrollListener();
    }
  });
  InfiniteScroll.setDefaultLoader = function (loader) {
    InfiniteScroll._defaultLoader = loader;
  };
  return InfiniteScroll;
};
@@ -1,135 +1,4 @@
-function topPosition(domElt) %7B%0A  if (!domElt) %7B%0A    return 0;%0A  %7D%0A  return domElt.offsetTop + topPosition(domElt.offsetParent);%0A%7D%0A%0A
 modu
@@ -435,16 +435,50 @@
 ltLoader
+,%0A        component: React.DOM.div
 %0A      %7D
@@ -567,16 +567,43 @@
 eStart;%0A
+      this.updated = true;%0A
     %7D,%0A 
@@ -721,34 +721,96 @@
 () %7B%0A      this.
-at
+updated = true;%0A      if (!this.props.hasMore) %7B%0A        this.de
 tachScrollListen
@@ -807,32 +807,40 @@
 rollListener();%0A
+      %7D%0A
     %7D,%0A    rende
@@ -903,26 +903,192 @@
 urn 
-React.DOM.div(null
+this.transferPropsTo(props.component(%7B%0A        pageStart: null%0A      , hasMore: null%0A      , loadMore: null%0A      , threshold: null%0A      , loader: null%0A      , component: null%0A      %7D
 , pr
@@ -1131,16 +1131,17 @@
 .loader)
+)
 ;%0A    %7D,
@@ -1185,32 +1185,93 @@
     
-var el = this.getDOMNode
+if (!this.updated) return;%0A      var coords = this.getDOMNode().getBoundingClientRect
 ();%0A
@@ -1280,25 +1280,22 @@
     var 
-scrollTop
+cutoff
  = (wind
@@ -1301,251 +1301,197 @@
 dow.
-pageYOffset !== undefined) ? window.pageYOffset : (document.documentElement %7C%7C document.body.parentNode %7C%7C document.body).scrollTop;%0A      if (topPosition(el) + el.offsetHeight - scrollTop - window.innerHeight %3C Number(this.props.threshold)) %7B
+innerHeight %7C%7C document.documentElement.clientHeight) + this.props.threshold;%0A%0A      if ((coords.bottom %3E= 0 && coords.left %3E= 0 && coords.bottom) %3C= cutoff) %7B%0A        this.updated = false;
 %0A   
@@ -1542,45 +1542,8 @@
 1);%0A
-        this.detachScrollListener();%0A
     

Allow custom component. Fix updating on mobile page