diff --git a/.size-snapshot.json b/.size-snapshot.json index fe99a10..5564bb7 100644 --- a/.size-snapshot.json +++ b/.size-snapshot.json @@ -1,18 +1,18 @@ { "dist/index.umd.js": { - "bundled": 66132, - "minified": 23326, - "gzipped": 7037 + "bundled": 51335, + "minified": 17586, + "gzipped": 5578 }, "dist/index.umd.min.js": { - "bundled": 31719, - "minified": 12888, - "gzipped": 4197 + "bundled": 25434, + "minified": 9901, + "gzipped": 3388 }, "dist/index.esm.js": { "bundled": 11581, "minified": 6824, - "gzipped": 1882, + "gzipped": 1880, "treeshaked": { "rollup": { "code": 3796, diff --git a/src/Popper.js b/src/Popper.js index 040992d..31e3ca4 100644 --- a/src/Popper.js +++ b/src/Popper.js @@ -9,7 +9,7 @@ import PopperJS, { } from 'popper.js'; import type { Style } from 'typed-styles'; import { ManagerContext } from './Manager'; -import { safeInvoke, unwrapArray, setRef } from './utils'; +import { unwrapArray, setRef } from './utils'; import { type Ref } from "./RefTypes"; type ReferenceElement = ReferenceObject | HTMLElement | null; diff --git a/src/Reference.js b/src/Reference.js index f362ff8..2ef243e 100644 --- a/src/Reference.js +++ b/src/Reference.js @@ -24,7 +24,7 @@ class InnerReference extends React.Component< }; componentWillUnmount() { - setRef(this.props.innerRef, node) + setRef(this.props.innerRef, null) } render() { diff --git a/typings/react-popper.d.ts b/typings/react-popper.d.ts index f24b206..64ea8ee 100644 --- a/typings/react-popper.d.ts +++ b/typings/react-popper.d.ts @@ -7,7 +7,10 @@ interface ManagerProps { export class Manager extends React.Component { } interface ReferenceChildrenProps { - ref: React.Ref; + // React refs are supposed to be contravariant (allows a more general type to be passed rather than a more specific one) + // However, Typescript currently can't infer that fact for refs + // See https://github.com/microsoft/TypeScript/issues/30748 for more information + ref: React.Ref; } interface ReferenceProps { @@ -17,7 +20,7 @@ interface ReferenceProps { export class Reference extends React.Component { } export interface PopperArrowProps { - ref: React.Ref; + ref: React.Ref; style: React.CSSProperties; } @@ -25,7 +28,7 @@ export interface PopperChildrenProps { arrowProps: PopperArrowProps; outOfBoundaries: boolean | null; placement: PopperJS.Placement; - ref: React.Ref; + ref: React.Ref; scheduleUpdate: () => void; style: React.CSSProperties; } @@ -33,7 +36,7 @@ export interface PopperChildrenProps { export interface PopperProps { children: (props: PopperChildrenProps) => React.ReactNode; eventsEnabled?: boolean; - innerRef?: React.Ref; + innerRef?: React.Ref; modifiers?: PopperJS.Modifiers; placement?: PopperJS.Placement; positionFixed?: boolean;