Skip to content

Commit f847b12

Browse files
authored
Merge pull request #11 from josephj/#10
#10 Fix - Image dimension not updating after window resizing
2 parents 343feca + 0aff6fc commit f847b12

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-justified-grid",
3-
"version": "0.0.2",
3+
"version": "0.0.3",
44
"description": "Rendering grid layout without cropping image",
55
"author": "josephj",
66
"license": "MIT",

src/index.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { getRowHeight, updateProcessedImageList } from './utils';
1212

1313
class JustifiedGrid extends React.Component<Props, State> {
1414
private wrapperEl: HTMLDivElement | null;
15+
private debounceResizeHandler: any;
1516
public static defaultProps: DefaultProps = {
1617
gutter: 1,
1718
rows: 3,
@@ -24,10 +25,8 @@ class JustifiedGrid extends React.Component<Props, State> {
2425
images: [],
2526
gridHeight: 0
2627
};
28+
this.debounceResizeHandler = debounce(this.handleWindowResize, 300);
2729
}
28-
debounceResizeHandler = (): void => {
29-
debounce(this.handleWindowResize, 300);
30-
};
3130
handleWindowResize = (): void => {
3231
this.sync();
3332
};

0 commit comments

Comments
 (0)