From fdb6cc6b2a669b31a5901d1468b8c9f81c5fb793 Mon Sep 17 00:00:00 2001 From: Miguel Alatzar Date: Wed, 26 Jun 2019 02:01:44 -0700 Subject: [PATCH] [MM-16456] Ensure Flatlist is mounted prior to calling scrollToOffset (#2925) * Ensure Flatlist is mounted prior to calling scrollToOffset * Make linter happy --- app/components/post_list/post_list.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/components/post_list/post_list.js b/app/components/post_list/post_list.js index 3cc733f04..ddbae2381 100644 --- a/app/components/post_list/post_list.js +++ b/app/components/post_list/post_list.js @@ -281,7 +281,9 @@ export default class PostList extends PureComponent { scrollToBottom = () => { setTimeout(() => { - this.flatListRef.current.scrollToOffset({offset: 0, animated: true}); + if (this.flatListRef && this.flatListRef.current) { + this.flatListRef.current.scrollToOffset({offset: 0, animated: true}); + } }, 250); };