Defensive fix for post list scrollToIndex (#1223)

This commit is contained in:
Chris Duarte 2017-11-28 11:51:06 -08:00 committed by enahum
parent 8233907b47
commit 18a5535205

View file

@ -81,7 +81,7 @@ export default class PostList extends PureComponent {
scrollList = () => {
InteractionManager.runAfterInteractions(() => {
if (this.props.postIds.length && this.newMessagesIndex !== -1) {
if (this.props.postIds.length && this.newMessagesIndex !== -1 && this.newMessagesIndex <= this.props.postIds.length) {
if (this.refs.list) {
this.refs.list.scrollToIndex({
index: this.newMessagesIndex,