Skip to content

Commit 162af93

Browse files
committed
Removes prop-types
1 parent 2a52e60 commit 162af93

File tree

3 files changed

+4
-41
lines changed

3 files changed

+4
-41
lines changed

README.md

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,7 @@ Use it via the render prop pattern (supports `children` or `render` prop):
2525
import { SizeMe } from 'react-sizeme'
2626

2727
function MyApp() {
28-
return (
29-
<SizeMe>
30-
{({ size }) => <div>My width is {size.width}px</div>}
31-
</SizeMe>
32-
)
28+
return <SizeMe>{({ size }) => <div>My width is {size.width}px</div>}</SizeMe>
3329
}
3430
```
3531

@@ -269,7 +265,6 @@ Should you wish to avoid the render of a placeholder and have an eager render of
269265

270266
```javascript
271267
import React from 'react';
272-
import PropTypes from 'prop-types';
273268
import LargeChildComponent from './LargeChildComponent';
274269
import SmallChildComponent from './SmallChildComponent';
275270
import sizeMe from 'react-sizeme';
@@ -288,12 +283,6 @@ function MyComponent(props) {
288283
</div>
289284
);
290285
}
291-
MyComponent.propTypes = {
292-
size: PropTypes.shape({
293-
width: PropTypes.number.isRequired,
294-
height: PropTypes.number.isRequired,
295-
})
296-
}
297286

298287
export default sizeMe({ monitorHeight: true })(MyComponent);
299288
```

src/component.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1+
/* eslint-disable react/prop-types */
2+
13
import React, { Component } from 'react'
24
import isShallowEqual from 'shallowequal'
3-
import PropTypes from 'prop-types'
45
import withSize from './with-size'
56

67
export default class SizeMe extends Component {
7-
static propTypes = {
8-
children: PropTypes.func,
9-
render: PropTypes.func,
10-
}
11-
128
static defaultProps = {
139
children: undefined,
1410
render: undefined,

src/with-size.js

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/* eslint-disable react/no-multi-comp */
2+
/* eslint-disable react/prop-types */
23
/* eslint-disable react/require-default-props */
34
/* eslint-disable react/no-find-dom-node */
45

56
import React, { Children, Component } from 'react'
6-
import PropTypes from 'prop-types'
77
import ReactDOM from 'react-dom'
88
import invariant from 'invariant'
99
import { debounce, throttle } from 'throttle-debounce'
@@ -38,7 +38,6 @@ class ReferenceWrapper extends Component {
3838
return Children.only(this.props.children)
3939
}
4040
}
41-
ReferenceWrapper.propTypes = { children: PropTypes.element.isRequired }
4241

4342
function Placeholder({ className, style }) {
4443
// Lets create the props for the temp element.
@@ -60,10 +59,6 @@ function Placeholder({ className, style }) {
6059
return <div {...phProps} />
6160
}
6261
Placeholder.displayName = 'SizeMePlaceholder'
63-
Placeholder.propTypes = {
64-
className: PropTypes.string,
65-
style: PropTypes.object,
66-
}
6762

6863
/**
6964
* As we need to maintain a ref on the root node that is rendered within our
@@ -112,19 +107,6 @@ const renderWrapper = WrappedComponent => {
112107
WrappedComponent,
113108
)})`
114109

115-
SizeMeRenderer.propTypes = {
116-
explicitRef: PropTypes.func.isRequired,
117-
className: PropTypes.string,
118-
style: PropTypes.object, // eslint-disable-line react/forbid-prop-types
119-
size: PropTypes.shape({
120-
width: PropTypes.number, // eslint-disable-line react/no-unused-prop-types
121-
height: PropTypes.number, // eslint-disable-line react/no-unused-prop-types
122-
position: PropTypes.object,
123-
}),
124-
disablePlaceholder: PropTypes.bool,
125-
onSize: PropTypes.func,
126-
}
127-
128110
return SizeMeRenderer
129111
}
130112

@@ -178,10 +160,6 @@ function withSize(config = defaultConfig) {
178160
class SizeAwareComponent extends React.Component {
179161
static displayName = `SizeMe(${getDisplayName(WrappedComponent)})`
180162

181-
static propTypes = {
182-
onSize: PropTypes.func,
183-
}
184-
185163
domEl = null
186164

187165
state = {

0 commit comments

Comments
 (0)