[react-measure][fix] Support useRef for innerRef prop on Measure (#41661)

* [react-measure][fix] Allow RefObject for innerRef prop on Measure

* Fix semicolons
This commit is contained in:
Stuart Olivera 2020-01-21 16:26:02 -08:00 committed by Ben Lichtman
parent b8a56bd21b
commit 7397dcc6d0
3 changed files with 7 additions and 2 deletions

View File

@ -52,7 +52,7 @@ export interface MeasureProps {
scroll?: boolean;
bounds?: boolean;
margin?: boolean;
innerRef?(ref: Element | null): void;
innerRef?: React.Ref<Element>;
onResize?(contentRect: ContentRect): void;
children?: React.SFC<MeasuredComponentProps>;
}

View File

@ -107,3 +107,8 @@ const funcEl = <MeasuredFunctionalComponent a="test" />;
const MeasuredClassComponent = withContentRect('bounds')<Props>(TestClassComponentWithProps);
const classEl = <MeasuredClassComponent a="test" />;
function testInnerRefHook() {
const ref = React.useRef<HTMLDivElement>();
return <Measure innerRef={ref} />;
}

View File

@ -23,4 +23,4 @@
"index.d.ts",
"react-measure-tests.tsx"
]
}
}