Skip to content

Commit

Permalink
fix onResize handler props
Browse files Browse the repository at this point in the history
  • Loading branch information
yeze322 committed Nov 9, 2020
1 parent 59e1e5f commit c9ba885
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ export const ElementMeasurer: React.FC<ElementMeasurerProps> = ({ children, styl
return (
<Measure
scroll
onResize={({ bounds }) => {
onResize={({ scroll }) => {
/**
* As a parent node, <Measure /> mounted before children mounted.
* Avoid flickering issue by filtering out the first onResize event.
*/
const { width, height } = bounds ?? { width: 0, height: 0 };
const { width, height } = scroll ?? { width: 0, height: 0 };
if (width === 0 && height === 0) return;
onResize(new Boundary(width, height));
}}
Expand Down

0 comments on commit c9ba885

Please sign in to comment.