Skip to content

Commit 2c4b0e8

Browse files
authored
Fix an fauly setState when container could be unmounted in future
1 parent 2508b4a commit 2c4b0e8

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

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)