1- import React , { useEffect , useRef , isValidElement , cloneElement } from 'react' ;
1+ import React , { useEffect , useRef } from 'react' ;
22import { supportRef } from 'rc-util/lib/ref' ;
33import findDOMNode from 'rc-util/lib/Dom/findDOMNode' ;
44import canUseDom from 'rc-util/lib/Dom/canUseDom' ;
55import DomWrapper from './wapper' ;
6-
7- interface MutationObserverProps {
8- children : React . ReactNode ;
9- options ?: MutationObserverInit ;
10- onMutate ?: ( mutations : MutationRecord [ ] , observer : MutationObserver ) => void ;
11- }
6+ import type { MutationObserverProps } from './interface' ;
127
138const defOptions : MutationObserverInit = {
149 subtree : true ,
@@ -21,7 +16,7 @@ const MutateObserver: React.FC<MutationObserverProps> = props => {
2116
2217 const wrapperRef = useRef < DomWrapper > ( null ) ;
2318
24- const canRef = isValidElement ( children ) && supportRef ( children ) ;
19+ const canRef = React . isValidElement ( children ) && supportRef ( children ) ;
2520
2621 useEffect ( ( ) => {
2722 if ( ! canUseDom ( ) ) {
@@ -49,7 +44,7 @@ const MutateObserver: React.FC<MutationObserverProps> = props => {
4944 return (
5045 < DomWrapper ref = { wrapperRef } >
5146 { canRef
52- ? cloneElement ( children as any , { ref : ( children as any ) . ref } )
47+ ? React . cloneElement ( children as any , { ref : ( children as any ) . ref } )
5348 : children }
5449 </ DomWrapper >
5550 ) ;
0 commit comments