Skip to content

Commit 51146b1

Browse files
authored
Merge pull request #54 from darekg11/master
Fix a faulty setState call when container could be unmounted in future
2 parents 2508b4a + f360e41 commit 51146b1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/ImageHeaderScrollView.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,11 @@ class ImageHeaderScrollView extends Component<Props, State> {
197197
if (!this.container) {
198198
return;
199199
}
200-
this.container.measureInWindow((x, y) => this.setState(() => ({ pageY: y })));
200+
this.container.measureInWindow((x, y) => {
201+
if (this.container) {
202+
this.setState(() => ({ pageY: y }));
203+
}
204+
});
201205
};
202206

203207
onScroll = (e: *) => {

0 commit comments

Comments
 (0)