Skip to content

Commit

Permalink
fix: radio disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
makkarMeenu committed Nov 16, 2021
1 parent 5023320 commit dcad172
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 24 deletions.
Expand Up @@ -5,7 +5,7 @@ export const Example = () => {
const [groupValue, setGroupValue] = React.useState('1');
return (
<Container>
<FormControl isDisabled>
<FormControl isInvalid>
<FormControl.Label _text={{ fontSize: 'lg', bold: true }}>
Select Prize
</FormControl.Label>
Expand Down
10 changes: 3 additions & 7 deletions src/components/primitives/Radio/Radio.tsx
Expand Up @@ -28,16 +28,12 @@ const Radio = ({ icon, wrapperRef, size, ...props }: IRadioProps, ref: any) => {

const contextState = React.useContext(RadioContext);

const {
isInvalid,
isReadOnly,
isIndeterminate,
...combinedProps
} = combineContextAndProps(contextState, props);
const combinedProps = combineContextAndProps(contextState, props);

const { isInvalid, isReadOnly, isIndeterminate } = combinedProps;
const inputRef = React.useRef(null);
const { inputProps } = useRadio(
{ ...props, ...combinedProps },
combinedProps,
contextState.state ?? {},
inputRef
);
Expand Down
21 changes: 5 additions & 16 deletions src/components/primitives/Radio/Radio.web.tsx
Expand Up @@ -20,21 +20,13 @@ const Radio = (
) => {
const contextState = React.useContext(RadioContext);

const {
isInvalid,
isReadOnly,
isIndeterminate,
...combinedProps
} = combineContextAndProps(contextState, props);
const combinedProps = combineContextAndProps(contextState, props);

const { isInvalid, isReadOnly, isIndeterminate } = combinedProps;

const inputRef = React.useRef(null);
const { inputProps } = useRadio(
{
...combinedProps,
...props,
'aria-label': props.accessibilityLabel,
children,
},
{ ...combinedProps, 'aria-label': props.accessibilityLabel, children },
contextState.state ?? {},
inputRef
);
Expand All @@ -54,10 +46,7 @@ const Radio = (

const { _interactionBox, _icon, ...resolvedProps } = usePropsResolution(
'Radio',
{
...combinedProps,
...RadioContext,
},
combinedProps,
{
isInvalid,
isReadOnly,
Expand Down

0 comments on commit dcad172

Please sign in to comment.