Remove react proptypes references (#9759)
Thibaut Rizzi committed
Sep 11, 2017 at 02:37 UTC
af312ce006ebe76307662d78d63328a047bd9780
3 files changed
+15
-14
docs/_js/live_editor.js
+8
-8
@@ -10,8 +10,8 @@ var IS_MOBILE = (
10
11
var CodeMirrorEditor = React.createClass({
12
propTypes: {
13
- lineNumbers: React.PropTypes.bool,
14
- onChange: React.PropTypes.func,
13
+ lineNumbers: PropTypes.bool,
14
+ onChange: PropTypes.func,
15
},
16
getDefaultProps: function() {
17
return {
@@ -80,12 +80,12 @@ var ReactPlayground = React.createClass({
80
MODES: {JSX: 'JSX', JS: 'JS'}, //keyMirror({JSX: true, JS: true}),
81
82
propTypes: {
83
- codeText: React.PropTypes.string.isRequired,
84
- transformer: React.PropTypes.func,
85
- renderCode: React.PropTypes.bool,
86
- showCompiledJSTab: React.PropTypes.bool,
87
- showLineNumbers: React.PropTypes.bool,
88
- editorTabTitle: React.PropTypes.string,
83
+ codeText: PropTypes.string.isRequired,
84
+ transformer: PropTypes.func,
85
+ renderCode: PropTypes.bool,
86
+ showCompiledJSTab: PropTypes.bool,
87
+ showLineNumbers: PropTypes.bool,
88
+ editorTabTitle: PropTypes.string,
89
},
90
91
getDefaultProps: function() {
docs/_layouts/default.html
+1
@@ -48,6 +48,7 @@
48
<script src="https://unpkg.com/codemirror@5.15.2/mode/javascript/javascript.js"></script>
49
<script src="https://unpkg.com/codemirror@5.15.2/mode/xml/xml.js"></script>
50
<script src="https://unpkg.com/codemirror@5.15.2/mode/jsx/jsx.js"></script>
51
+ <script src="https://unpkg.com/prop-types/prop-types.min.js"></script>
52
<script src="https://unpkg.com/react/dist/react.min.js"></script>
53
<script src="https://unpkg.com/react-dom/dist/react-dom.min.js"></script>
54
<script src="https://unpkg.com/babel-standalone@6.15.0/babel.min.js"></script>
docs/warnings/dont-call-proptypes.md
+6
-6
@@ -18,7 +18,7 @@ The normal usage of PropTypes is still supported:
18
19
```javascript
20
Button.propTypes = {
21
- highlighted: React.PropTypes.bool
21
+ highlighted: PropTypes.bool
22
};
23
```
24
@@ -29,9 +29,9 @@ Nothing changes here.
29
Using PropTypes in any other way than annotating React components with them is no longer supported:
30
31
```javascript
32
-var apiShape = React.PropTypes.shape({
33
- body: React.PropTypes.object,
34
- statusCode: React.PropTypes.number.isRequired
32
+var apiShape = PropTypes.shape({
33
+ body: PropTypes.object,
34
+ statusCode: PropTypes.number.isRequired
35
}).isRequired;
36
37
// Not supported!
@@ -49,13 +49,13 @@ Inspect the stack trace produced by the warning. You will find the component def
49
```js
50
Button.propTypes = {
51
highlighted: ThirdPartyPropTypes.deprecated(
52
- React.PropTypes.bool,
52
+ PropTypes.bool,
53
'Use `active` prop instead'
54
)
55
}
56
```
57
58
-In this case, `ThirdPartyPropTypes.deprecated` is a wrapper calling `React.PropTypes.bool`. This pattern by itself is fine, but triggers a false positive because React thinks you are calling PropTypes directly. The next section explains how to fix this problem for a library implementing something like `ThirdPartyPropTypes`. If it's not a library you wrote, you can file an issue against it.
58
+In this case, `ThirdPartyPropTypes.deprecated` is a wrapper calling `PropTypes.bool`. This pattern by itself is fine, but triggers a false positive because React thinks you are calling PropTypes directly. The next section explains how to fix this problem for a library implementing something like `ThirdPartyPropTypes`. If it's not a library you wrote, you can file an issue against it.
59
60
### Fixing the false positive in third party PropTypes
61