diff --git a/HTML.js b/HTML.js index 5d2cdb3..1ed52b3 100644 --- a/HTML.js +++ b/HTML.js @@ -6,6 +6,7 @@ import HTMLElement from './HTMLElement' import HTMLTextNode from './HTMLTextNode' import HTMLRenderers from './HTMLRenderers' import HTMLStyles from './HTMLStyles' +import PropTypes from 'prop-types'; class HTML extends React.Component { /* ****************************************************************************/ @@ -13,10 +14,10 @@ class HTML extends React.Component { /* ****************************************************************************/ static propTypes = { - html: React.PropTypes.string.isRequired, - htmlStyles: React.PropTypes.object, - onLinkPress: React.PropTypes.func, - renderers: React.PropTypes.object.isRequired + html: PropTypes.string.isRequired, + htmlStyles: PropTypes.object, + onLinkPress: PropTypes.func, + renderers: PropTypes.object.isRequired } static defaultProps = { diff --git a/HTMLElement.js b/HTMLElement.js index 84ffb4a..0df3412 100644 --- a/HTMLElement.js +++ b/HTMLElement.js @@ -2,6 +2,7 @@ import React from 'react' import { Text, View } from 'react-native' import shallowCompare from 'react-addons-shallow-compare' import HTMLStyles from './HTMLStyles' +import PropTypes from 'prop-types'; class HTMLElement extends React.Component { /* ****************************************************************************/ @@ -9,15 +10,15 @@ class HTMLElement extends React.Component { /* ****************************************************************************/ static propTypes = { - tagName: React.PropTypes.string.isRequired, - renderers: React.PropTypes.object.isRequired, - groupInfo: React.PropTypes.object, - parentTagName: React.PropTypes.string, - htmlStyles: React.PropTypes.object, - htmlAttibs: React.PropTypes.object, - onLinkPress: React.PropTypes.func, - children: React.PropTypes.node, - parentIsText: React.PropTypes.bool.isRequired + tagName: PropTypes.string.isRequired, + renderers: PropTypes.object.isRequired, + groupInfo: PropTypes.object, + parentTagName: PropTypes.string, + htmlStyles: PropTypes.object, + htmlAttibs: PropTypes.object, + onLinkPress: PropTypes.func, + children: PropTypes.node, + parentIsText: PropTypes.bool.isRequired } /* ****************************************************************************/ diff --git a/HTMLStyles.js b/HTMLStyles.js index f805d60..dc3cdfc 100644 --- a/HTMLStyles.js +++ b/HTMLStyles.js @@ -1,6 +1,6 @@ import { StyleSheet } from 'react-native' import React from 'react' -import ReactPropTypeLocations from 'react/lib/ReactPropTypeLocations' +import PropTypes from 'prop-types'; // We have to do some munging here as the objects are wrapped import _RNTextStylePropTypes from 'react-native/Libraries/Text/TextStylePropTypes' @@ -171,13 +171,13 @@ class HTMLStyles { const testStyle = {} testStyle[key] = value - if (styleProps[key](testStyle, key, '', ReactPropTypeLocations.prop)) { + if (styleProps[key](testStyle, key, '', 'prop')) { // See if we can convert a 20px to a 20 automagically - if (styleProps[key] === React.PropTypes.number) { + if (styleProps[key] === PropTypes.number) { const numericValue = parseFloat(value.replace('px', '')) if (!isNaN(numericValue)) { testStyle[key] = numericValue - if (!styleProps[key](testStyle, key, '', ReactPropTypeLocations.prop)) { + if (!styleProps[key](testStyle, key, '', 'prop')) { return [key, numericValue] } } diff --git a/HTMLTextNode.js b/HTMLTextNode.js index 446b9de..260ec6a 100644 --- a/HTMLTextNode.js +++ b/HTMLTextNode.js @@ -2,6 +2,7 @@ import React from 'react' import { Text } from 'react-native' import shallowCompare from 'react-addons-shallow-compare' import { AllHtmlEntities } from 'html-entities' +import PropTypes from 'prop-types'; const RE = Object.freeze({ MULT_WHITESPACE: new RegExp(/\s+/g), @@ -27,7 +28,7 @@ class HTMLTextNode extends React.Component { /* ****************************************************************************/ static propTypes = { - children: React.PropTypes.string.isRequired + children: PropTypes.string.isRequired } /** diff --git a/package.json b/package.json index da8bd1c..972cfb6 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,8 @@ "peerDependencies": { "react": ">=0.14.8", "react-native": ">=0.24.0", - "react-addons-shallow-compare": ">=0.14.8" + "react-addons-shallow-compare": ">=0.14.8", + "prop-types": "^15.6.0" }, "standard": { "parser": "babel-eslint"