From 576793fc715812e3d520747a31afdf5326b1e5c5 Mon Sep 17 00:00:00 2001 From: Ayush Gupta Date: Wed, 20 Jul 2022 12:52:50 +0530 Subject: [PATCH] fix(blade-old): remove unnecessary warning for `Checkbox` props (#546) --- .changeset/early-mayflies-retire.md | 5 +++++ packages/blade-old/src/atoms/Checkbox/Checkbox.native.js | 4 ++-- packages/blade-old/src/atoms/Checkbox/Checkbox.web.js | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 .changeset/early-mayflies-retire.md diff --git a/.changeset/early-mayflies-retire.md b/.changeset/early-mayflies-retire.md new file mode 100644 index 00000000000..cd4e5cdc0ce --- /dev/null +++ b/.changeset/early-mayflies-retire.md @@ -0,0 +1,5 @@ +--- +"@razorpay/blade-old": patch +--- + +fix(checkbox): remove unnecessary warning for checkbox props diff --git a/packages/blade-old/src/atoms/Checkbox/Checkbox.native.js b/packages/blade-old/src/atoms/Checkbox/Checkbox.native.js index 4aaabfc7439..69b5135f2fd 100644 --- a/packages/blade-old/src/atoms/Checkbox/Checkbox.native.js +++ b/packages/blade-old/src/atoms/Checkbox/Checkbox.native.js @@ -228,7 +228,7 @@ Checkbox.propTypes = { onChange: PropTypes.func.isRequired, testID: PropTypes.string, helpText: (props, propName, componentName) => { - if (props.size === 'small') { + if (props.size === 'small' && props.helpText !== '') { return new Error( `[${propName}]. ${propName} is ignored as it is not supported when size is small in ${componentName}`, ); @@ -243,7 +243,7 @@ Checkbox.propTypes = { return null; }, errorText: (props, propName, componentName) => { - if (props.size === 'small') { + if (props.size === 'small' && props.errorText !== '') { return new Error( `[${propName}]. ${propName} is ignored as it is not supported when size is small in ${componentName}`, ); diff --git a/packages/blade-old/src/atoms/Checkbox/Checkbox.web.js b/packages/blade-old/src/atoms/Checkbox/Checkbox.web.js index 2f6b0f9c910..7dacb75adda 100644 --- a/packages/blade-old/src/atoms/Checkbox/Checkbox.web.js +++ b/packages/blade-old/src/atoms/Checkbox/Checkbox.web.js @@ -277,7 +277,7 @@ Checkbox.propTypes = { id: PropTypes.string, name: PropTypes.string, helpText: (props, propName, componentName) => { - if (props.size === 'small') { + if (props.size === 'small' && props.helpText !== '') { return new Error( `[${propName}]. ${propName} is ignored as it is not supported when size is small in ${componentName}`, ); @@ -292,7 +292,7 @@ Checkbox.propTypes = { return null; }, errorText: (props, propName, componentName) => { - if (props.size === 'small') { + if (props.size === 'small' && props.errorText !== '') { return new Error( `[${propName}]. ${propName} is ignored as it is not supported when size is small in ${componentName}`, );