Skip to content

Commit 2092fa1

Browse files
committed
refactor: Remove legacy api
1 parent bb94258 commit 2092fa1

File tree

2 files changed

+7
-64
lines changed

2 files changed

+7
-64
lines changed

src/TriggerWrapper.tsx

-44
This file was deleted.

src/index.tsx

+7-20
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import useLayoutEffect from '@rc-component/util/lib/hooks/useLayoutEffect';
1010
import isMobile from '@rc-component/util/lib/isMobile';
1111
import * as React from 'react';
1212
import Popup from './Popup';
13-
import TriggerWrapper from './TriggerWrapper';
1413
import type { TriggerContextProps } from './context';
1514
import TriggerContext from './context';
1615
import useAction from './hooks/useAction';
@@ -113,13 +112,6 @@ export interface TriggerProps {
113112
// ==================== Arrow ====================
114113
arrow?: boolean | ArrowTypeOuter;
115114

116-
// =================== Private ===================
117-
/**
118-
* @private Get trigger DOM node.
119-
* Used for some component is function component which can not access by `findDOMNode`
120-
*/
121-
getTriggerDOMNode?: (node: React.ReactInstance) => HTMLElement;
122-
123115
// // ========================== Mobile ==========================
124116
// /** @private Bump fixed position at bottom in mobile.
125117
// * This is internal usage currently, do not use in your prod */
@@ -188,9 +180,6 @@ export function generateTrigger(
188180
popupMotion,
189181
maskMotion,
190182

191-
// Private
192-
getTriggerDOMNode,
193-
194183
...restProps
195184
} = props;
196185

@@ -634,12 +623,6 @@ export function generateTrigger(
634623
}
635624
});
636625

637-
// Child Node
638-
const triggerNode = React.cloneElement(child, {
639-
...mergedChildrenProps,
640-
...passedProps,
641-
});
642-
643626
const arrowPos: ArrowPos = {
644627
x: arrowX,
645628
y: arrowY,
@@ -652,6 +635,12 @@ export function generateTrigger(
652635
}
653636
: null;
654637

638+
// Child Node
639+
const triggerNode = React.cloneElement(child, {
640+
...mergedChildrenProps,
641+
...passedProps,
642+
});
643+
655644
// Render
656645
return (
657646
<>
@@ -660,9 +649,7 @@ export function generateTrigger(
660649
ref={setTargetRef}
661650
onResize={onTargetResize}
662651
>
663-
<TriggerWrapper getTriggerDOMNode={getTriggerDOMNode}>
664-
{triggerNode}
665-
</TriggerWrapper>
652+
{triggerNode}
666653
</ResizeObserver>
667654
<TriggerContext.Provider value={context}>
668655
<Popup

0 commit comments

Comments
 (0)