Browse Source

type: replace any type with CheckboxRef (#43599)

pull/43620/head
lijianan 1 year ago
committed by GitHub
parent
commit
d178eee50a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 0
      components/radio/context.ts
  2. 0
      components/radio/index.ts
  3. 0
      components/radio/interface.ts
  4. 9
      components/radio/radioButton.tsx

0
components/radio/context.tsx → components/radio/context.ts

0
components/radio/index.tsx → components/radio/index.ts

0
components/radio/interface.tsx → components/radio/interface.ts

9
components/radio/radioButton.tsx

@ -1,4 +1,5 @@
import * as React from 'react';
import type { CheckboxRef } from '../checkbox';
import type { AbstractCheckboxProps } from '../checkbox/Checkbox';
import { ConfigContext } from '../config-provider';
import { RadioOptionTypeContextProvider } from './context';
@ -7,17 +8,17 @@ import Radio from './radio';
export type RadioButtonProps = AbstractCheckboxProps<RadioChangeEvent>;
const RadioButton = (props: RadioButtonProps, ref: React.Ref<any>) => {
const RadioButton: React.ForwardRefRenderFunction<CheckboxRef, RadioButtonProps> = (props, ref) => {
const { getPrefixCls } = React.useContext(ConfigContext);
const { prefixCls: customizePrefixCls, ...radioProps } = props;
const prefixCls = getPrefixCls('radio', customizePrefixCls);
return (
<RadioOptionTypeContextProvider value="button">
<Radio prefixCls={prefixCls} {...radioProps} type="radio" ref={ref} />
<RadioOptionTypeContextProvider value='button'>
<Radio prefixCls={prefixCls} {...radioProps} type='radio' ref={ref} />
</RadioOptionTypeContextProvider>
);
};
export default React.forwardRef(RadioButton);
export default React.forwardRef<CheckboxRef, RadioButtonProps>(RadioButton);

Loading…
Cancel
Save