2021-12-23 11:51:10 +08:00
|
|
|
import * as React from 'react';
|
2019-12-05 16:15:10 +08:00
|
|
|
import Trigger from 'rc-trigger/lib/mock';
|
2022-12-19 13:31:41 +08:00
|
|
|
import type { TriggerProps } from 'rc-trigger';
|
2022-07-25 21:04:43 +08:00
|
|
|
import { TriggerMockContext } from '../shared/demoTestContext';
|
2017-11-11 00:07:03 +08:00
|
|
|
|
2022-12-19 13:31:41 +08:00
|
|
|
const ForwardTrigger = React.forwardRef<any, TriggerProps>((props, ref) => {
|
2021-12-23 11:51:10 +08:00
|
|
|
const mergedPopupVisible = React.useContext(TriggerMockContext) ?? props.popupVisible;
|
2022-12-19 13:31:41 +08:00
|
|
|
(global as any).triggerProps = props;
|
|
|
|
return <Trigger {...props} ref={ref} popupVisible={mergedPopupVisible as boolean} />;
|
2021-12-23 11:51:10 +08:00
|
|
|
});
|
2022-12-19 13:31:41 +08:00
|
|
|
|
|
|
|
export default ForwardTrigger;
|