mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-05 21:48:19 +08:00
13 lines
518 B
TypeScript
13 lines
518 B
TypeScript
import * as React from 'react';
|
|
import Trigger from 'rc-trigger/lib/mock';
|
|
import type { TriggerProps } from 'rc-trigger';
|
|
import { TriggerMockContext } from '../shared/demoTestContext';
|
|
|
|
const ForwardTrigger = React.forwardRef<any, TriggerProps>((props, ref) => {
|
|
const mergedPopupVisible = React.useContext(TriggerMockContext) ?? props.popupVisible;
|
|
(global as any).triggerProps = props;
|
|
return <Trigger {...props} ref={ref} popupVisible={mergedPopupVisible as boolean} />;
|
|
});
|
|
|
|
export default ForwardTrigger;
|