Skip to content

Commit ec82480

Browse files
committed
Move getComponent to instance method.
1 parent a6db35e commit ec82480

File tree

1 file changed

+34
-34
lines changed

1 file changed

+34
-34
lines changed

src/Trigger.jsx

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -67,40 +67,6 @@ const Trigger = React.createClass({
6767
mountNode.appendChild(popupContainer);
6868
return popupContainer;
6969
},
70-
71-
getComponent(instance) {
72-
const { props, state } = instance;
73-
const mouseProps = {};
74-
if (instance.isMouseEnterToShow()) {
75-
mouseProps.onMouseEnter = instance.onPopupMouseEnter;
76-
}
77-
if (instance.isMouseLeaveToHide()) {
78-
mouseProps.onMouseLeave = instance.onPopupMouseLeave;
79-
}
80-
return (
81-
<Popup
82-
prefixCls={props.prefixCls}
83-
destroyPopupOnHide={props.destroyPopupOnHide}
84-
visible={state.popupVisible}
85-
className={props.popupClassName}
86-
action={props.action}
87-
align={instance.getPopupAlign()}
88-
onAlign={props.onPopupAlign}
89-
animation={props.popupAnimation}
90-
getClassNameFromAlign={instance.getPopupClassNameFromAlign}
91-
{...mouseProps}
92-
getRootDomNode={instance.getRootDomNode}
93-
style={props.popupStyle}
94-
mask={props.mask}
95-
zIndex={props.zIndex}
96-
transitionName={props.popupTransitionName}
97-
maskAnimation={props.maskAnimation}
98-
maskTransitionName={props.maskTransitionName}
99-
>
100-
{typeof props.popup === 'function' ? props.popup() : props.popup}
101-
</Popup>
102-
);
103-
},
10470
}),
10571
],
10672

@@ -325,6 +291,40 @@ const Trigger = React.createClass({
325291
return popupAlign;
326292
},
327293

294+
getComponent() {
295+
const { props, state } = this;
296+
const mouseProps = {};
297+
if (this.isMouseEnterToShow()) {
298+
mouseProps.onMouseEnter = this.onPopupMouseEnter;
299+
}
300+
if (this.isMouseLeaveToHide()) {
301+
mouseProps.onMouseLeave = this.onPopupMouseLeave;
302+
}
303+
return (
304+
<Popup
305+
prefixCls={props.prefixCls}
306+
destroyPopupOnHide={props.destroyPopupOnHide}
307+
visible={state.popupVisible}
308+
className={props.popupClassName}
309+
action={props.action}
310+
align={this.getPopupAlign()}
311+
onAlign={props.onPopupAlign}
312+
animation={props.popupAnimation}
313+
getClassNameFromAlign={this.getPopupClassNameFromAlign}
314+
{...mouseProps}
315+
getRootDomNode={this.getRootDomNode}
316+
style={props.popupStyle}
317+
mask={props.mask}
318+
zIndex={props.zIndex}
319+
transitionName={props.popupTransitionName}
320+
maskAnimation={props.maskAnimation}
321+
maskTransitionName={props.maskTransitionName}
322+
>
323+
{typeof props.popup === 'function' ? props.popup() : props.popup}
324+
</Popup>
325+
);
326+
},
327+
328328
setPopupVisible(popupVisible) {
329329
this.clearDelayTimer();
330330
if (this.state.popupVisible !== popupVisible) {

0 commit comments

Comments
 (0)