From b98812f84f7a7fcbed5521949763d4273c5ccf97 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 8634cf44e..50e6989c8 100644 --- a/app/components/post_list/post_list.js +++ b/app/components/post_list/post_list.js @@ -292,7 +292,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({