Skip to content

Commit

Permalink
fix: form control label and form check
Browse files Browse the repository at this point in the history
  • Loading branch information
richardmichel committed May 13, 2023
1 parent b772e62 commit 03f17d4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/components/FormCheck.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,14 @@ const FormCheck: BsPrefixRefForwardingComponent<'input', FormCheckProps> =
/>
);

const handleSelect = () => {
// @ts-ignore
if(ref?.current){
// @ts-ignore
ref?.current?.click()
}
}

return (
<FormContext.Provider value={innerFormContext}>
<div
Expand All @@ -187,6 +195,11 @@ const FormCheck: BsPrefixRefForwardingComponent<'input', FormCheckProps> =
reverse && `${bsPrefix}-reverse`,
type === 'switch' && bsSwitchPrefix,
)}
{...{
...(!children && {
onClick: handleSelect,
}),
}}
>
{children || (
<>
Expand Down
2 changes: 2 additions & 0 deletions src/components/FormControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ const propTypes = {
isInvalid: PropTypes.bool,

isFloatingLabel: PropTypes.bool,

error: PropTypes.any,
};

const FormControl: BsPrefixRefForwardingComponent<'input', FormControlProps> =
Expand Down

0 comments on commit 03f17d4

Please sign in to comment.