diff --git a/components/anchor/Anchor.tsx b/components/anchor/Anchor.tsx index 47015b6230..4c885240c6 100644 --- a/components/anchor/Anchor.tsx +++ b/components/anchor/Anchor.tsx @@ -221,7 +221,8 @@ export default class Anchor extends React.Component { return; } const { prefixCls } = this.props; - const linkNode = ReactDOM.findDOMNode(this as any).getElementsByClassName(`${prefixCls}-link-title-active`)[0]; + const anchorNode = ReactDOM.findDOMNode(this) as Element; + const linkNode = anchorNode.getElementsByClassName(`${prefixCls}-link-title-active`)[0]; if (linkNode) { this.inkNode.style.top = `${(linkNode as any).offsetTop + linkNode.clientHeight / 2 - 4.5}px`; } diff --git a/components/avatar/index.tsx b/components/avatar/index.tsx index 7dae88dbaa..e694086b87 100644 --- a/components/avatar/index.tsx +++ b/components/avatar/index.tsx @@ -55,7 +55,8 @@ export default class Avatar extends React.Component { const childrenNode = this.avatarChildren; if (childrenNode) { const childrenWidth = childrenNode.offsetWidth; - const avatarWidth = ReactDOM.findDOMNode(this).getBoundingClientRect().width; + const avatarNode = ReactDOM.findDOMNode(this) as Element; + const avatarWidth = avatarNode.getBoundingClientRect().width; // add 4px gap for each side to get better performance if (avatarWidth - 8 < childrenWidth) { this.setState({ diff --git a/components/form/FormItem.tsx b/components/form/FormItem.tsx index 4e17e3930d..48b69c08aa 100644 --- a/components/form/FormItem.tsx +++ b/components/form/FormItem.tsx @@ -248,7 +248,8 @@ export default class FormItem extends React.Component { if (typeof label === 'string') { e.preventDefault(); } - const control = ReactDOM.findDOMNode(this).querySelector(`[id="${id}"]`) as HTMLElement; + const formItemNode = ReactDOM.findDOMNode(this) as Element; + const control = formItemNode.querySelector(`[id="${id}"]`) as HTMLElement; if (control && control.focus) { control.focus(); } diff --git a/components/menu/index.tsx b/components/menu/index.tsx index 842583a872..dc400969ee 100644 --- a/components/menu/index.tsx +++ b/components/menu/index.tsx @@ -121,8 +121,9 @@ export default class Menu extends React.Component { } if ((nextProps.inlineCollapsed && !this.props.inlineCollapsed) || (nextContext.siderCollapsed && !this.context.siderCollapsed)) { + const menuNode = findDOMNode(this) as Element; this.switchModeFromInline = - !!this.state.openKeys.length && !!findDOMNode(this).querySelectorAll(`.${prefixCls}-submenu-open`).length; + !!this.state.openKeys.length && !!menuNode.querySelectorAll(`.${prefixCls}-submenu-open`).length; this.inlineOpenKeys = this.state.openKeys; this.setState({ openKeys: [] }); } diff --git a/components/tabs/index.tsx b/components/tabs/index.tsx index 4e400a6928..cb1b0769b6 100755 --- a/components/tabs/index.tsx +++ b/components/tabs/index.tsx @@ -79,7 +79,7 @@ export default class Tabs extends React.Component { componentDidMount() { const NO_FLEX = ' no-flex'; - const tabNode = ReactDOM.findDOMNode(this); + const tabNode = ReactDOM.findDOMNode(this) as Element; if (tabNode && !isFlexSupported() && tabNode.className.indexOf(NO_FLEX) === -1) { tabNode.className += NO_FLEX; } diff --git a/components/transfer/list.tsx b/components/transfer/list.tsx index 3cbfbb07fc..483b277875 100644 --- a/components/transfer/list.tsx +++ b/components/transfer/list.tsx @@ -101,7 +101,8 @@ export default class TransferList extends React.Component { - const listNode = ReactDOM.findDOMNode(this).querySelectorAll('.ant-transfer-list-content')[0]; + const transferNode = ReactDOM.findDOMNode(this) as Element; + const listNode = transferNode.querySelectorAll('.ant-transfer-list-content')[0]; if (listNode) { triggerEvent(listNode, 'scroll'); }