2016-10-04 17:58:26 +02:00
|
|
|
import { Component, PropTypes } from 'react';
|
|
|
|
import ReactDOM from 'react-dom';
|
|
|
|
|
|
|
|
export default class ScrollSyncPane extends Component {
|
|
|
|
|
|
|
|
static propTypes = {
|
|
|
|
children: PropTypes.node.isRequired,
|
2016-10-18 12:32:39 -02:00
|
|
|
attachTo: PropTypes.any,
|
2016-10-04 17:58:26 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
static contextTypes = {
|
|
|
|
registerPane: PropTypes.func.isRequired,
|
|
|
|
unregisterPane: PropTypes.func.isRequired,
|
|
|
|
};
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
this.node = this.props.attachTo || ReactDOM.findDOMNode(this);
|
|
|
|
this.context.registerPane(this.node);
|
|
|
|
}
|
|
|
|
|
|
|
|
componentWillUnmount() {
|
|
|
|
this.context.unregisterPane(this.node);
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return this.props.children;
|
|
|
|
}
|
|
|
|
}
|