Skip to content

Commit 2fc5495

Browse files
committed
set width and height propTypes to number explicitly
1 parent 0b10ed9 commit 2fc5495

2 files changed

Lines changed: 6 additions & 12 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import React from 'react';
3838
import ReactLoading from 'react-loading';
3939

4040
const Example = ({ type, color }) => (
41-
<ReactLoading type={type} color={color} height='667' width='375' />
41+
<ReactLoading type={type} color={color} height={667} width={375} />
4242
);
4343

4444
export default Example;
@@ -51,8 +51,8 @@ export default Example;
5151
| type | String | balls |
5252
| color | String | `#ffffff` |
5353
| delay | Number | 1000 (msecs) |
54-
| height | Number or String | 64 (px) |
55-
| width | Number or String | 64 (px) |
54+
| height | Number | 64 (px) |
55+
| width | Number | 64 (px) |
5656
| className | String | `''` |
5757

5858

lib/react-loading.jsx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,8 @@ export default class Loading extends Component {
88
color: PropTypes.string,
99
delay: PropTypes.number,
1010
type: PropTypes.string,
11-
height: PropTypes.oneOfType([
12-
PropTypes.number,
13-
PropTypes.string,
14-
]),
15-
width: PropTypes.oneOfType([
16-
PropTypes.number,
17-
PropTypes.string,
18-
]),
11+
height: PropTypes.number,
12+
width: PropTypes.number,
1913
};
2014

2115
static defaultProps = {
@@ -53,7 +47,7 @@ export default class Loading extends Component {
5347

5448
render() {
5549
const {
56-
color, delay, type, height, width, ...restProps
50+
color, type, height, width, ...restProps
5751
} = this.props;
5852
const selectedType = this.state.delayed ? 'blank' : type;
5953
const svg = svgSources[selectedType];

0 commit comments

Comments
 (0)