From 5c766b1f9922c968668cdca14d50710868ab746a Mon Sep 17 00:00:00 2001 From: Wei Zhu Date: Thu, 7 Sep 2017 20:44:05 -0500 Subject: [PATCH] refactor: popconfirm string refs to callback (#7491) --- components/popconfirm/index.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/components/popconfirm/index.tsx b/components/popconfirm/index.tsx index 95896a6643..be13faf2e1 100644 --- a/components/popconfirm/index.tsx +++ b/components/popconfirm/index.tsx @@ -23,9 +23,7 @@ abstract class Popconfirm extends React.Component { okType: 'primary', }; - refs: { - tooltip: Tooltip, - }; + tooltip: Tooltip; constructor(props: PopconfirmProps) { super(props); @@ -44,7 +42,7 @@ abstract class Popconfirm extends React.Component { } getPopupDomNode() { - return this.refs.tooltip.getPopupDomNode(); + return this.tooltip.getPopupDomNode(); } onConfirm = (e) => { @@ -81,6 +79,10 @@ abstract class Popconfirm extends React.Component { } } + saveTooltip = (node) => { + this.tooltip = node; + } + render() { const { prefixCls, title, placement, okText, okType, cancelText, ...restProps } = this.props; const popconfirmLocale = this.getLocale(); @@ -112,7 +114,7 @@ abstract class Popconfirm extends React.Component { onVisibleChange={this.onVisibleChange} visible={this.state.visible} overlay={overlay} - ref="tooltip" + ref={this.saveTooltip} /> ); }