Skip to content

Commit

Permalink
feat(react): add support for react 16 & use prop-types gorangajic#23
Browse files Browse the repository at this point in the history
  • Loading branch information
evenchange4 committed Oct 13, 2017
1 parent 8efe1de commit bb2ce42
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 15 deletions.
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
"url": "https://github.com/gorangajic/react-svg-morph/issues"
},
"dependencies": {
"prop-types": "^15.6.0",
"react": "^16.0.0",
"react-dom": "^16.0.0",
"react-render-to-json": "0.0.4",
"svgpath": "^2.1.0"
},
Expand All @@ -39,7 +42,7 @@
"webpack": "^1.12.2"
},
"peerDependencies": {
"react": "^0.14.0 || ^15.0.0",
"react-dom": "^0.14.0 || ^15.0.0"
"react": "^0.14.0 || ^15.0.0 || ^16.0.0",
"react-dom": "^0.14.0 || ^15.0.0 || ^16.0.0"
}
}
13 changes: 7 additions & 6 deletions src/MorphReplace.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// request animation frame

import React from 'react';
import PropTypes from 'prop-types';
import MorphTransition from './MorphTransition';

export default
Expand Down Expand Up @@ -66,12 +67,12 @@ class MorphReplace extends React.Component {
}

MorphReplace.propTypes = {
rotation: React.PropTypes.oneOf(['clockwise', 'counterclock', 'none']),
width: React.PropTypes.number,
height: React.PropTypes.number,
duration: React.PropTypes.number,
children: React.PropTypes.element,
viewBox: React.PropTypes.string,
rotation: PropTypes.oneOf(['clockwise', 'counterclock', 'none']),
width: PropTypes.number,
height: PropTypes.number,
duration: PropTypes.number,
children: PropTypes.element,
viewBox: PropTypes.string,
preserveAspectRatio: function(props, propName, componentName) {
const regexp = /^(\s+)?(none|xMinYMin|xMidYMin|xMaxYMin|xMinYMid|xMidYMid|xMaxYMid|xMinYMax|xMidYMax|xMaxYMax)(\s+)?(meet|slice)?(\s+)?$/;
if (!regexp.test(props[propName])) {
Expand Down
15 changes: 8 additions & 7 deletions src/MorphTransition.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import PropTypes from 'prop-types';
import normalizeSvg from './utils/normalizeSvg';
import { normalizePaths, getProgress } from './utils/morph';
import renderToJson from 'react-render-to-json';
Expand Down Expand Up @@ -95,13 +96,13 @@ class MorphTransition extends React.Component {
}

MorphTransition.propTypes = {
rotation: React.PropTypes.oneOf(['clockwise', 'counterclock', 'none']),
width: React.PropTypes.number,
height: React.PropTypes.number,
duration: React.PropTypes.number,
progress: React.PropTypes.number,
children: React.PropTypes.object,
viewBox: React.PropTypes.string,
rotation: PropTypes.oneOf(['clockwise', 'counterclock', 'none']),
width: PropTypes.number,
height: PropTypes.number,
duration: PropTypes.number,
progress: PropTypes.number,
children: PropTypes.object,
viewBox: PropTypes.string,
preserveAspectRatio: function(props, propName, componentName) {
const regexp = /^(\s+)?(none|xMinYMin|xMidYMin|xMaxYMin|xMinYMid|xMidYMid|xMaxYMid|xMinYMax|xMidYMax|xMaxYMax)(\s+)?(meet|slice)?(\s+)?$/;
if (!regexp.test(props[propName])) {
Expand Down

0 comments on commit bb2ce42

Please sign in to comment.