Skip to content
This repository was archived by the owner on Aug 1, 2022. It is now read-only.

Commit 0d05ec9

Browse files
joelgfzembiem
authored andcommitted
Allow number and string for canvas dimensions (#18)
Allow `number` and `string` types for `canvasWidth` and `canvasHeight` properties to avoid unnecessary warnings.
1 parent 861b743 commit 0d05ec9

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/index.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ const canvasTypes = [
3838
}
3939
];
4040

41+
const dimensionsPropTypes = PropTypes.oneOfType([
42+
PropTypes.number,
43+
PropTypes.string
44+
]);
45+
4146
export default class extends PureComponent {
4247
static propTypes = {
4348
loadTimeOffset: PropTypes.number,
@@ -47,8 +52,8 @@ export default class extends PureComponent {
4752
catenaryColor: PropTypes.string,
4853
gridColor: PropTypes.string,
4954
hideGrid: PropTypes.bool,
50-
canvasWidth: PropTypes.number,
51-
canvasHeight: PropTypes.number,
55+
canvasWidth: dimensionsPropTypes,
56+
canvasHeight: dimensionsPropTypes,
5257
disabled: PropTypes.bool,
5358
imgSrc: PropTypes.string,
5459
saveData: PropTypes.string,

0 commit comments

Comments
 (0)