Browse Source

Fix type errors

Close #9988
pull/9991/head
Wei Zhu 7 years ago
parent
commit
2a5479a524
  1. 3
      components/anchor/Anchor.tsx
  2. 3
      components/avatar/index.tsx
  3. 3
      components/form/FormItem.tsx
  4. 3
      components/menu/index.tsx
  5. 2
      components/tabs/index.tsx
  6. 3
      components/transfer/list.tsx

3
components/anchor/Anchor.tsx

@ -221,7 +221,8 @@ export default class Anchor extends React.Component<AnchorProps, any> {
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`;
}

3
components/avatar/index.tsx

@ -55,7 +55,8 @@ export default class Avatar extends React.Component<AvatarProps, AvatarState> {
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({

3
components/form/FormItem.tsx

@ -248,7 +248,8 @@ export default class FormItem extends React.Component<FormItemProps, any> {
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();
}

3
components/menu/index.tsx

@ -121,8 +121,9 @@ export default class Menu extends React.Component<MenuProps, MenuState> {
}
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: [] });
}

2
components/tabs/index.tsx

@ -79,7 +79,7 @@ export default class Tabs extends React.Component<TabsProps, any> {
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;
}

3
components/transfer/list.tsx

@ -101,7 +101,8 @@ export default class TransferList extends React.Component<TransferListProps, any
// Manually trigger scroll event for lazy search bug
// https://github.com/ant-design/ant-design/issues/5631
this.triggerScrollTimer = window.setTimeout(() => {
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');
}

Loading…
Cancel
Save