[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 71f96fc1cf
commit b98812f84f

View file

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