From 583febb82a7286f23d099288c01c46061e61381e Mon Sep 17 00:00:00 2001 From: Jimmy Jia Date: Thu, 13 Aug 2015 13:03:52 -0400 Subject: [PATCH] [removed] unnecessary functionality in React v0.14 --- src/Modal.js | 12 -------- src/OverlayTrigger.js | 17 ----------- src/utils/createContextWrapper.js | 47 ------------------------------- test/OverlayTriggerSpec.js | 5 ++-- 4 files changed, 2 insertions(+), 79 deletions(-) delete mode 100644 src/utils/createContextWrapper.js diff --git a/src/Modal.js b/src/Modal.js index 8e4022137f..148b856a8f 100644 --- a/src/Modal.js +++ b/src/Modal.js @@ -325,10 +325,6 @@ const Modal = React.createClass({ container.style.paddingRight = parseInt(this._originalPadding || 0, 10) + getScrollbarSize() + 'px'; } - if (this.props.backdrop) { - this.iosClickHack(); - } - this.setState(this._getStyles() //eslint-disable-line react/no-did-mount-set-state , () => this.focusModalContent()); }, @@ -418,14 +414,6 @@ const Modal = React.createClass({ } }, - iosClickHack() { - // IOS only allows click events to be delegated to the document on elements - // it considers 'clickable' - anchors, buttons, etc. We fake a click handler on the - // DOM nodes themselves. Remove if handled by React: https://github.com/facebook/react/issues/1169 - this.refs.modal.onclick = function () {}; - this.refs.backdrop.onclick = function () {}; - }, - _getStyles() { if (!domUtils.canUseDom) { return {}; diff --git a/src/OverlayTrigger.js b/src/OverlayTrigger.js index 93a64e4238..079b4a0c49 100644 --- a/src/OverlayTrigger.js +++ b/src/OverlayTrigger.js @@ -8,7 +8,6 @@ import warning from 'warning'; import Overlay from './Overlay'; import createChainedFunction from './utils/createChainedFunction'; -import createContextWrapper from './utils/createContextWrapper'; /** * Check if value one is inside or equal to the of value @@ -263,20 +262,4 @@ const OverlayTrigger = React.createClass({ }); -/** - * Creates a new OverlayTrigger class that forwards the relevant context - * - * This static method should only be called at the module level, instead of in - * e.g. a render() method, because it's expensive to create new classes. - * - * For example, you would want to have: - * - * > export default OverlayTrigger.withContext({ - * > myContextKey: React.PropTypes.object - * > }); - * - * and import this when needed. - */ -OverlayTrigger.withContext = createContextWrapper(OverlayTrigger, 'overlay'); - export default OverlayTrigger; diff --git a/src/utils/createContextWrapper.js b/src/utils/createContextWrapper.js deleted file mode 100644 index 37e8a1a82e..0000000000 --- a/src/utils/createContextWrapper.js +++ /dev/null @@ -1,47 +0,0 @@ -import React from 'react'; - -/** - * Creates new trigger class that injects context into overlay. - */ -export default function createContextWrapper(Trigger, propName) { - return function (contextTypes) { - class ContextWrapper extends React.Component { - getChildContext() { - return this.props.context; - } - - render() { - // Strip injected props from below. - const {wrapped, context, ...props} = this.props; - - return React.cloneElement(wrapped, props); - } - } - ContextWrapper.childContextTypes = contextTypes; - - class TriggerWithContext { - render() { - const props = {...this.props}; - props[propName] = this.getWrappedOverlay(); - - return ( - - {this.props.children} - - ); - } - - getWrappedOverlay() { - return ( - - ); - } - } - TriggerWithContext.contextTypes = contextTypes; - - return TriggerWithContext; - }; -} diff --git a/test/OverlayTriggerSpec.js b/test/OverlayTriggerSpec.js index 866129e15f..7583a83d69 100644 --- a/test/OverlayTriggerSpec.js +++ b/test/OverlayTriggerSpec.js @@ -103,7 +103,6 @@ describe('OverlayTrigger', function() { } ContextReader.contextTypes = contextTypes; - const TriggerWithContext = OverlayTrigger.withContext(contextTypes); class ContextHolder extends React.Component { getChildContext() { return {key: 'value'}; @@ -111,12 +110,12 @@ describe('OverlayTrigger', function() { render() { return ( - } > - + ); } }