Remove deprecated features at React v15.5 (#1905)

* Remove deprecated features at React v15.5

- [x] React.PropTypes
- [x] react-addons-pure-render-mixin
- [x] react-addons-test-utils

* Uncommented out & Add browserify_rails options

* re-add react-addons-shallow

* Fix syntax error from resolve conflicts

* follow up 59a77923b3
This commit is contained in:
Yamagishi Kazutoshi 2017-04-22 03:05:35 +09:00 committed by Eugen
parent 27ea2a88c1
commit 1948f9e767
83 changed files with 1441 additions and 1291 deletions

View file

@ -1,4 +1,4 @@
import PureRenderMixin from 'react-addons-pure-render-mixin';
import PropTypes from 'prop-types';
import MediaModal from './media_modal';
import OnboardingModal from './onboarding_modal';
import VideoModal from './video_modal';
@ -12,37 +12,34 @@ const MODAL_COMPONENTS = {
'BOOST': BoostModal
};
const ModalRoot = React.createClass({
class ModalRoot extends React.PureComponent {
propTypes: {
type: React.PropTypes.string,
props: React.PropTypes.object,
onClose: React.PropTypes.func.isRequired
},
mixins: [PureRenderMixin],
constructor (props, context) {
super(props, context);
this.handleKeyUp = this.handleKeyUp.bind(this);
}
handleKeyUp (e) {
if (e.key === 'Escape' && !!this.props.type) {
this.props.onClose();
}
},
}
componentDidMount () {
window.addEventListener('keyup', this.handleKeyUp, false);
},
}
componentWillUnmount () {
window.removeEventListener('keyup', this.handleKeyUp);
},
}
willEnter () {
return { opacity: 0, scale: 0.98 };
},
}
willLeave () {
return { opacity: spring(0), scale: spring(0.98) };
},
}
render () {
const { type, props, onClose } = this.props;
@ -81,6 +78,12 @@ const ModalRoot = React.createClass({
);
}
});
}
ModalRoot.propTypes = {
type: PropTypes.string,
props: PropTypes.object,
onClose: PropTypes.func.isRequired
};
export default ModalRoot;