Prevent More unreads indicators when canceling jump to... (#1082)

This commit is contained in:
enahum 2017-11-01 18:50:28 -03:00
parent 853ef2cde3
commit dd9d245e39

View file

@ -4,6 +4,7 @@
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {
InteractionManager,
SectionList,
Text,
TouchableHighlight,
@ -298,18 +299,17 @@ class List extends PureComponent {
}, 100);
updateUnreadIndicators = ({viewableItems}) => {
const {unreadChannelIds} = this.props;
const firstUnread = unreadChannelIds[0];
if (firstUnread) {
const isVisible = viewableItems.find((v) => v.item === firstUnread);
InteractionManager.runAfterInteractions(() => {
const {unreadChannelIds} = this.props;
const firstUnread = unreadChannelIds.length && unreadChannelIds[0];
if (firstUnread && viewableItems.length) {
const isVisible = viewableItems.find((v) => v.item === firstUnread);
if (isVisible) {
return this.emitUnreadIndicatorChange(false);
return this.emitUnreadIndicatorChange(!isVisible);
}
return this.emitUnreadIndicatorChange(true);
}
return this.emitUnreadIndicatorChange(false);
return this.emitUnreadIndicatorChange(false);
});
};
render() {