Skip to content
This repository was archived by the owner on Mar 22, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions HTML.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@ 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 {
/* ****************************************************************************/
// Class
/* ****************************************************************************/

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 = {
Expand Down
19 changes: 10 additions & 9 deletions HTMLElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,23 @@ 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 {
/* ****************************************************************************/
// Class
/* ****************************************************************************/

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
}

/* ****************************************************************************/
Expand Down
8 changes: 4 additions & 4 deletions HTMLStyles.js
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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]
}
}
Expand Down
3 changes: 2 additions & 1 deletion HTMLTextNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -27,7 +28,7 @@ class HTMLTextNode extends React.Component {
/* ****************************************************************************/

static propTypes = {
children: React.PropTypes.string.isRequired
children: PropTypes.string.isRequired
}

/**
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down