mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-28 13:09:40 +08:00
refactor: popconfirm string refs to callback (#7491)
This commit is contained in:
parent
4664e36fa4
commit
5c766b1f99
@ -23,9 +23,7 @@ abstract class Popconfirm extends React.Component<PopconfirmProps, any> {
|
|||||||
okType: 'primary',
|
okType: 'primary',
|
||||||
};
|
};
|
||||||
|
|
||||||
refs: {
|
tooltip: Tooltip;
|
||||||
tooltip: Tooltip,
|
|
||||||
};
|
|
||||||
|
|
||||||
constructor(props: PopconfirmProps) {
|
constructor(props: PopconfirmProps) {
|
||||||
super(props);
|
super(props);
|
||||||
@ -44,7 +42,7 @@ abstract class Popconfirm extends React.Component<PopconfirmProps, any> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getPopupDomNode() {
|
getPopupDomNode() {
|
||||||
return this.refs.tooltip.getPopupDomNode();
|
return this.tooltip.getPopupDomNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
onConfirm = (e) => {
|
onConfirm = (e) => {
|
||||||
@ -81,6 +79,10 @@ abstract class Popconfirm extends React.Component<PopconfirmProps, any> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
saveTooltip = (node) => {
|
||||||
|
this.tooltip = node;
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { prefixCls, title, placement, okText, okType, cancelText, ...restProps } = this.props;
|
const { prefixCls, title, placement, okText, okType, cancelText, ...restProps } = this.props;
|
||||||
const popconfirmLocale = this.getLocale();
|
const popconfirmLocale = this.getLocale();
|
||||||
@ -112,7 +114,7 @@ abstract class Popconfirm extends React.Component<PopconfirmProps, any> {
|
|||||||
onVisibleChange={this.onVisibleChange}
|
onVisibleChange={this.onVisibleChange}
|
||||||
visible={this.state.visible}
|
visible={this.state.visible}
|
||||||
overlay={overlay}
|
overlay={overlay}
|
||||||
ref="tooltip"
|
ref={this.saveTooltip}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user