mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 19:19:57 +08:00
fix: Radio cannot use Tooltip (#27050)
resolve #26921 resolve #25222 close #26929
This commit is contained in:
parent
f812855122
commit
7662160880
@ -7,7 +7,7 @@ import RadioGroupContext from './context';
|
||||
import { composeRef } from '../_util/ref';
|
||||
import devWarning from '../_util/devWarning';
|
||||
|
||||
const InternalRadio: React.ForwardRefRenderFunction<unknown, RadioProps> = (props, ref) => {
|
||||
const InternalRadio: React.ForwardRefRenderFunction<HTMLElement, RadioProps> = (props, ref) => {
|
||||
const context = React.useContext(RadioGroupContext);
|
||||
const { getPrefixCls, direction } = React.useContext(ConfigContext);
|
||||
const innerRef = React.useRef<HTMLElement>();
|
||||
@ -37,8 +37,8 @@ const InternalRadio: React.ForwardRefRenderFunction<unknown, RadioProps> = (prop
|
||||
radioProps.disabled = props.disabled || context.disabled;
|
||||
}
|
||||
const wrapperClassString = classNames(
|
||||
`${prefixCls}-wrapper`,
|
||||
{
|
||||
[`${prefixCls}-wrapper`]: true,
|
||||
[`${prefixCls}-wrapper-checked`]: radioProps.checked,
|
||||
[`${prefixCls}-wrapper-disabled`]: radioProps.disabled,
|
||||
[`${prefixCls}-wrapper-rtl`]: direction === 'rtl',
|
||||
@ -54,13 +54,14 @@ const InternalRadio: React.ForwardRefRenderFunction<unknown, RadioProps> = (prop
|
||||
onMouseEnter={props.onMouseEnter}
|
||||
onMouseLeave={props.onMouseLeave}
|
||||
>
|
||||
<RcCheckbox {...radioProps} prefixCls={prefixCls} ref={mergedRef as any} />
|
||||
<RcCheckbox {...radioProps} prefixCls={prefixCls} ref={mergedRef} />
|
||||
{children !== undefined ? <span>{children}</span> : null}
|
||||
</label>
|
||||
);
|
||||
};
|
||||
|
||||
const Radio = React.forwardRef<unknown, RadioProps>(InternalRadio);
|
||||
|
||||
Radio.displayName = 'Radio';
|
||||
|
||||
Radio.defaultProps = {
|
||||
|
@ -185,6 +185,7 @@ span.@{radio-prefix-cls} + * {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: -1;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user