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

Loading…
Cancel
Save