From afeaeaddcb10e0b9cf7e3442c93162ef786fc402 Mon Sep 17 00:00:00 2001 From: KK <58529914+kk-gjyang@users.noreply.github.com> Date: Mon, 15 Mar 2021 19:25:01 -0300 Subject: [PATCH] Add parameters `height` and `width` To allow user to customize the size of switch. --- src/Switch.jsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Switch.jsx b/src/Switch.jsx index 4266356..763b091 100644 --- a/src/Switch.jsx +++ b/src/Switch.jsx @@ -19,6 +19,8 @@ export default class Switch extends React.Component { pendingOnColor: PropTypes.string, readOnly: PropTypes.bool, style: PropTypes.object, + width: PropTypes.number, + height: Proptypes.number, }; static defaultProps = { @@ -78,7 +80,7 @@ export default class Switch extends React.Component { } getHeight() { - return 30; + return height || 30; } getOffColor() { @@ -134,7 +136,7 @@ export default class Switch extends React.Component { } getWidth() { - return 50; + return width || 50; } handleChange(e) {