Skip to content

Commit 2df2c64

Browse files
committed
Use prop-types instead of deprecated React.Proptypes
1 parent a8a36a7 commit 2df2c64

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,8 @@
5757
"mocha": "^2.3.3"
5858
},
5959
"author": "jrichardlai",
60-
"license": "MIT"
60+
"license": "MIT",
61+
"dependencies": {
62+
"prop-types": "^15.5.10"
63+
}
6164
}

src/ParsedText.js

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from 'react';
22
import ReactNative from 'react-native';
3+
import PropTypes from 'prop-types';
34

45
import TextExtraction from './lib/TextExtraction';
56

@@ -9,14 +10,14 @@ const PATTERNS = {
910
email: /\S+@\S+\.\S+/,
1011
};
1112

12-
const defaultParseShape = React.PropTypes.shape({
13+
const defaultParseShape = PropTypes.shape({
1314
...ReactNative.Text.propTypes,
14-
type: React.PropTypes.oneOf(Object.keys(PATTERNS)).isRequired,
15+
type: PropTypes.oneOf(Object.keys(PATTERNS)).isRequired,
1516
});
1617

17-
const customParseShape = React.PropTypes.shape({
18+
const customParseShape = PropTypes.shape({
1819
...ReactNative.Text.propTypes,
19-
pattern: React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.instanceOf(RegExp)]).isRequired,
20+
pattern: PropTypes.oneOfType([PropTypes.string, PropTypes.instanceOf(RegExp)]).isRequired,
2021
});
2122

2223
class ParsedText extends React.Component {
@@ -25,10 +26,10 @@ class ParsedText extends React.Component {
2526

2627
static propTypes = {
2728
...ReactNative.Text.propTypes,
28-
parse: React.PropTypes.arrayOf(
29-
React.PropTypes.oneOfType([defaultParseShape, customParseShape]),
29+
parse: PropTypes.arrayOf(
30+
PropTypes.oneOfType([defaultParseShape, customParseShape]),
3031
),
31-
childrenProps: React.PropTypes.shape(ReactNative.Text.propTypes),
32+
childrenProps: PropTypes.shape(ReactNative.Text.propTypes),
3233
};
3334

3435
static defaultProps = {

0 commit comments

Comments
 (0)