/**
 * Created by laiff on 10.12.14.
 */

var React = require('react');

/**
 * Prevent default behavior for event
 *
 * @param e
 * @returns {boolean}
 */
var cancelScrollEvent = function (e) {
    e.stopImmediatePropagation();
    e.preventDefault();
    e.returnValue = false;
    return false;
};

var addScrollEventListener = function (elem, handler) {
    elem.addEventListener('wheel', handler, false);
};

var removeScrollEventListener = function (elem, handler) {
    elem.removeEventListener('wheel', handler, false);
};

/**
 * @extends ReactCompositeComponentInterface
 *
 * @mixin ScrollLock
 */
var ScrollLock = {

    componentDidMount: function () {
        this.scrollLock();
    },

    componentDidUpdate: function () {
        this.scrollLock();
    },

    componentWillUnmount: function () {
        this.scrollRelease();
    },

    scrollLock: function () {
        var elem = React.findDOMNode(this);
        if (elem) {
            addScrollEventListener(elem, this.onScrollHandler);
        }
    },

    scrollRelease: function () {
        var elem = React.findDOMNode(this);
        if (elem) {
            removeScrollEventListener(elem, this.onScrollHandler);
        }
    },

    onScrollHandler: function (e) {
        var elem = React.findDOMNode(this);
        var scrollTop = elem.scrollTop;
        var scrollHeight = elem.scrollHeight;
        var height = elem.clientHeight;
        var wheelDelta = e.deltaY;
        var isDeltaPositive = wheelDelta > 0;

        if (isDeltaPositive && wheelDelta > scrollHeight - height - scrollTop) {
            elem.scrollTop = scrollHeight;
            return cancelScrollEvent(e);
        }
        else if (!isDeltaPositive && -wheelDelta > scrollTop) {
            elem.scrollTop = 0;
            return cancelScrollEvent(e);
        }
    }
};

module.exports = ScrollLock;

@@ -44,16 +44,19 @@
 ar React
+DOM
  = requi
@@ -64,16 +64,20 @@
 e('react
+-dom
 ');%0A%0A/**
@@ -898,32 +898,35 @@
 var elem = React
+DOM
 .findDOMNode(thi
@@ -921,32 +921,32 @@
 dDOMNode(this);%0A
-
         if (elem
@@ -1080,32 +1080,35 @@
 var elem = React
+DOM
 .findDOMNode(thi
@@ -1248,24 +1248,24 @@
 ction (e) %7B%0A
-
         var 
@@ -1276,16 +1276,19 @@
  = React
+DOM
 .findDOM

Use ReactDOM