[MM-17016] Ensure Flatlist is mounted prior to calling scrollToIndex (#2977)

* Ensure Flatlist is mounted prior to calling scrollToIndex

* Address review comment
This commit is contained in:
Miguel Alatzar 2019-07-16 06:07:59 -07:00 committed by Saturnino Abril
parent 175c0df5d9
commit 085a3ecf6c

View file

@ -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({