UNPKG

1.89 kBJavaScriptView Raw
1import _extends from 'babel-runtime/helpers/extends';
2import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
3import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
4import _inherits from 'babel-runtime/helpers/inherits';
5
6var _class, _temp2;
7
8import React from 'react';
9import { findDOMNode } from 'react-dom';
10import PropTypes from 'prop-types';
11import FixedBody from '../fixed/body';
12
13/* eslint-disable react/prefer-stateless-function */
14var LockBody = (_temp2 = _class = function (_React$Component) {
15 _inherits(LockBody, _React$Component);
16
17 function LockBody() {
18 var _temp, _this, _ret;
19
20 _classCallCheck(this, LockBody);
21
22 for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
23 args[_key] = arguments[_key];
24 }
25
26 return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.onBodyScroll = function (event) {
27 _this.context.onLockBodyScroll(event);
28 }, _temp), _possibleConstructorReturn(_this, _ret);
29 }
30
31 LockBody.prototype.componentDidMount = function componentDidMount() {
32 this.context.getLockNode('body', findDOMNode(this), this.context.lockType);
33 };
34
35 LockBody.prototype.render = function render() {
36 var event = {
37 onLockScroll: this.onBodyScroll
38 };
39 return React.createElement(FixedBody, _extends({}, this.props, event));
40 };
41
42 return LockBody;
43}(React.Component), _class.propTypes = _extends({}, FixedBody.propTypes), _class.contextTypes = _extends({}, FixedBody.contextTypes, {
44 getLockNode: PropTypes.func,
45 onLockBodyScroll: PropTypes.func,
46 lockType: PropTypes.oneOf(['left', 'right'])
47}), _temp2);
48LockBody.displayName = 'LockBody';
49export { LockBody as default };
\No newline at end of file