Skip to content

Commit

Permalink
try to remove findDOMNode from wawe
Browse files Browse the repository at this point in the history
  • Loading branch information
lift46252 committed Aug 30, 2024
1 parent fe7f795 commit 47a6a90
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions components/_util/wave.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as React from 'react';
import { findDOMNode } from 'react-dom';
import TransitionEvents from '@ant-design/css-animation/lib/Event';
import raf from './raf';
import { ConfigConsumer, ConfigConsumerProps, CSPConfig, ConfigContext } from '../config-provider';
Expand All @@ -26,6 +25,8 @@ function isNotGrey(color: string) {
export default class Wave extends React.Component<{ insertExtraNode?: boolean }> {
static contextType = ConfigContext;

private childrenRef = React.createRef<HTMLDivElement>();

private instance?: {
cancel: () => void;
};
Expand All @@ -45,7 +46,7 @@ export default class Wave extends React.Component<{ insertExtraNode?: boolean }>
context: ConfigConsumerProps;

componentDidMount() {
const node = findDOMNode(this) as HTMLElement;
const node = this.childrenRef.current;
if (!node || node.nodeType !== 1) {
return;
}
Expand Down Expand Up @@ -112,8 +113,8 @@ export default class Wave extends React.Component<{ insertExtraNode?: boolean }>
return;
}

const node = findDOMNode(this) as HTMLElement;
if (!e || e.target !== node || this.animationStart) {
const node = this.childrenRef.current;
if (!e || !node || e.target !== node || this.animationStart) {
return;
}
this.resetEffect(node);
Expand Down Expand Up @@ -195,7 +196,7 @@ export default class Wave extends React.Component<{ insertExtraNode?: boolean }>
const { children } = this.props;
this.csp = csp;

return children;
return <div ref={this.childrenRef}>{children}</div>;
};

render() {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "antd",
"version": "4.7.0-fix-rc-select-v5",
"version": "4.7.0-fix-dropdown-v1",
"description": "An enterprise-class UI design language and React components implementation",
"title": "Ant Design",
"keywords": [
Expand Down

0 comments on commit 47a6a90

Please sign in to comment.