Skip to content

Commit

Permalink
docs: update FAQ about findDOMNode warning (ant-design#47475)
Browse files Browse the repository at this point in the history
* docs: update findDOMNode docs

* Revert "docs: update findDOMNode docs"

This reverts commit 3672670.

* docs: update FAQ about findDOMNode warning

* fix: fix
  • Loading branch information
li-jia-nan authored Feb 19, 2024
1 parent ed25a45 commit d9bb666
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
10 changes: 9 additions & 1 deletion components/popover/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,12 @@ Please ensure that the child node of `Popover` accepts `onMouseEnter`, `onMouseL

## FAQ

Please ref [Tooltip FAQ](/components/tooltip#faq).
### Why does the warning findDOMNode is deprecated some times appear in strict mode?

This is due to the implementation of `rc-trigger`. `rc-trigger` forces children to accept ref, otherwise it will fall back to findDOMNode, so children need to be native html tags. If not, you need to use `React. forwardRef` transparently passes `ref` to native html tags.

### Why sometime not work on HOC?

Please ensure that the child node of `Tooltip` accepts `onMouseEnter`, `onMouseLeave`, `onPointerEnter`, `onPointerLeave`, `onFocus`, `onClick` events.

For more questions, please refer to [Tooltip FAQ](/components/tooltip#faq).
10 changes: 9 additions & 1 deletion components/popover/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,12 @@ demo:

## FAQ

请参考 [Tooltip FAQ](/components/tooltip#faq)
### 为何在严格模式中有时候会出现 findDOMNode is deprecated 这个警告?

这是由于 `rc-trigger` 的实现方式导致的,`rc-trigger` 强制要求 children 能够接受 ref,否则就会 fallback 到 findDOMNode,所以 children 需要是原生 html 标签,如果不是,则需要使用 `React.forwardRef``ref` 透传到原生 html 标签。

### 为何有时候 HOC 组件无法生效?

请确保 `Popover` 的子元素能接受 `onMouseEnter``onMouseLeave``onPointerEnter``onPointerLeave``onFocus``onClick` 事件。

更多问题,请参考 [Tooltip FAQ](/components/tooltip#faq)
4 changes: 4 additions & 0 deletions components/tooltip/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ The following APIs are shared by Tooltip, Popconfirm, Popover.

## FAQ

### Why does the warning findDOMNode is deprecated some times appear in strict mode?

This is due to the implementation of `rc-trigger`. `rc-trigger` forces children to accept ref, otherwise it will fall back to findDOMNode, so children need to be native html tags. If not, you need to use `React. forwardRef` transparently passes `ref` to native html tags.

### Why sometime not work on HOC?

Please ensure that the child node of `Tooltip` accepts `onMouseEnter`, `onMouseLeave`, `onPointerEnter`, `onPointerLeave`, `onFocus`, `onClick` events.
Expand Down
4 changes: 4 additions & 0 deletions components/tooltip/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ demo:

## FAQ

### 为何在严格模式中有时候会出现 findDOMNode is deprecated 这个警告?

这是由于 `rc-trigger` 的实现方式导致的,`rc-trigger` 强制要求 children 能够接受 ref,否则就会 fallback 到 findDOMNode,所以 children 需要是原生 html 标签,如果不是,则需要使用 `React.forwardRef``ref` 透传到原生 html 标签。

### 为何有时候 HOC 组件无法生效?

请确保 `Tooltip` 的子元素能接受 `onMouseEnter``onMouseLeave``onPointerEnter``onPointerLeave``onFocus``onClick` 事件。
Expand Down

0 comments on commit d9bb666

Please sign in to comment.