Skip to content

Commit

Permalink
Merge pull request #277 from jquense/clone-with-props
Browse files Browse the repository at this point in the history
Future proof cloneWithProps a little. Remove unused internal utils
  • Loading branch information
stevoland committed Nov 18, 2014
2 parents 9751f49 + 726c730 commit 0cf72c8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 99 deletions.
63 changes: 0 additions & 63 deletions src/utils/ReactContext.js

This file was deleted.

32 changes: 0 additions & 32 deletions src/utils/ReactCurrentOwner.js

This file was deleted.

13 changes: 9 additions & 4 deletions src/utils/cloneWithProps.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,17 @@ function cloneWithProps(child, props) {
newProps.children = child.props.children;
}

if (React.version.substr(0, 4) === '0.12'){
var mockLegacyFactory = function(){};
mockLegacyFactory.isReactLegacyFactory = true;
mockLegacyFactory.type = child.type;

return React.createElement(mockLegacyFactory, newProps);
}

// The current API doesn't retain _owner and _context, which is why this
// doesn't use ReactElement.cloneAndReplaceProps.
var mockLegacyFactory = function(){};
mockLegacyFactory.isReactLegacyFactory = true;
mockLegacyFactory.type = child.type;
return React.createElement(mockLegacyFactory, newProps);
return React.createElement(child.type, newProps);
}

module.exports = cloneWithProps;

0 comments on commit 0cf72c8

Please sign in to comment.