@@ -9,19 +9,19 @@ import PopperJS, {
99} from 'popper.js' ;
1010import type { Style } from 'typed-styles' ;
1111import { ManagerContext } from './Manager' ;
12- import { safeInvoke , unwrapArray , shallowEqual } from './utils' ;
12+ import { unwrapArray , setRef , shallowEqual } from './utils' ;
13+ import { type Ref } from "./RefTypes" ;
1314
14- type getRefFn = ( ?HTMLElement ) => void ;
1515type ReferenceElement = ReferenceObject | HTMLElement | null ;
1616type StyleOffsets = { top : number , left : number } ;
1717type StylePosition = { position : 'absolute' | 'fixed' } ;
1818
1919export type PopperArrowProps = {
20- ref : getRefFn ,
20+ ref : Ref ,
2121 style : StyleOffsets & Style ,
2222} ;
2323export type PopperChildrenProps = { |
24- ref : getRefFn ,
24+ ref : Ref ,
2525 style : StyleOffsets & StylePosition & Style ,
2626 placement : Placement ,
2727 outOfBoundaries : ?boolean ,
@@ -33,7 +33,7 @@ export type PopperChildren = PopperChildrenProps => React.Node;
3333export type PopperProps = {
3434 children : PopperChildren ,
3535 eventsEnabled ?: boolean ,
36- innerRef ?: getRefFn ,
36+ innerRef ?: Ref ,
3737 modifiers ?: Modifiers ,
3838 placement ?: Placement ,
3939 positionFixed ?: boolean ,
@@ -76,7 +76,7 @@ export class InnerPopper extends React.Component<PopperProps, PopperState> {
7676 setPopperNode = ( popperNode : ?HTMLElement ) => {
7777 if ( ! popperNode || this . popperNode === popperNode ) return ;
7878
79- safeInvoke ( this . props . innerRef , popperNode ) ;
79+ setRef ( this . props . innerRef , popperNode ) ;
8080 this . popperNode = popperNode ;
8181
8282 this . updatePopperInstance ( ) ;
@@ -200,7 +200,7 @@ export class InnerPopper extends React.Component<PopperProps, PopperState> {
200200 }
201201
202202 componentWillUnmount ( ) {
203- safeInvoke ( this . props . innerRef , null ) ;
203+ setRef ( this . props . innerRef , null )
204204 this . destroyPopperInstance ( ) ;
205205 }
206206
0 commit comments