From 085a3ecf6c26130b25ff42dbcb66e0a1171fe992 Mon Sep 17 00:00:00 2001 From: Miguel Alatzar Date: Tue, 16 Jul 2019 06:07:59 -0700 Subject: [PATCH] [MM-17016] Ensure Flatlist is mounted prior to calling scrollToIndex (#2977) * Ensure Flatlist is mounted prior to calling scrollToIndex * Address review comment --- app/components/post_list/post_list.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/components/post_list/post_list.js b/app/components/post_list/post_list.js index 262c0d373..b7bf7fee5 100644 --- a/app/components/post_list/post_list.js +++ b/app/components/post_list/post_list.js @@ -291,7 +291,8 @@ export default class PostList extends PureComponent { width > 0 && height > 0 && this.props.initialIndex > 0 && - !this.hasDoneInitialScroll + !this.hasDoneInitialScroll && + this.flatListRef?.current ) { requestAnimationFrame(() => { this.flatListRef.current.scrollToIndex({