Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
Merge pull request #25 from evenchange4/feature/react-16
Browse files Browse the repository at this point in the history
feat(react): add support for react 16 & use the prop-types library  #23
  • Loading branch information
gorangajic authored Nov 17, 2017
2 parents 8efe1de + 033927f commit 6560898
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"url": "https://github.com/gorangajic/react-svg-morph/issues"
},
"dependencies": {
"prop-types": "^15.6.0",
"react-render-to-json": "0.0.4",
"svgpath": "^2.1.0"
},
Expand All @@ -39,7 +40,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 6560898

Please sign in to comment.