Skip to content

Commit 132ed6f

Browse files
authored
refactor: use rc-util getNodeRef (#212)
1 parent 1ab2eec commit 132ed6f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"dependencies": {
4545
"@babel/runtime": "^7.20.7",
4646
"classnames": "^2.2.1",
47-
"rc-util": "^5.38.0",
47+
"rc-util": "^5.44.1",
4848
"resize-observer-polyfill": "^1.5.1"
4949
},
5050
"devDependencies": {

src/SingleObserver/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import findDOMNode from 'rc-util/lib/Dom/findDOMNode';
2-
import { supportRef, useComposeRef } from 'rc-util/lib/ref';
2+
import { supportRef, useComposeRef, getNodeRef } from 'rc-util/lib/ref';
33
import * as React from 'react';
44
import type { ResizeObserverProps } from '..';
55
import { CollectionContext } from '../Collection';
@@ -32,7 +32,7 @@ function SingleObserver(props: SingleObserverProps, ref: React.Ref<HTMLElement>)
3232
// ============================= Ref ==============================
3333
const canRef =
3434
!isRenderProps && React.isValidElement(mergedChildren) && supportRef(mergedChildren);
35-
const originRef: React.Ref<Element> = canRef ? (mergedChildren as any).ref : null;
35+
const originRef: React.Ref<Element> = canRef ? getNodeRef(mergedChildren) : null;
3636

3737
const mergedRef = useComposeRef(originRef, elementRef);
3838

0 commit comments

Comments
 (0)