Fix empty firstDay

master
Vitaliy Filippov 2016-10-02 22:18:15 +03:00
parent ca8e1feb9e
commit 6d2b3e2aa9
1 changed files with 3 additions and 3 deletions

View File

@ -29,7 +29,7 @@ var MessageList = React.createClass({
mixins: [ ListWithSelection ], mixins: [ ListWithSelection ],
getInitialState: function() getInitialState: function()
{ {
return { firstDayTop: 0, firstDay: this.props.groups && this.props.groups[0] && this.props.groups[0].name || '', groups: this.props.groups||[] /*FIXME*/ }; return { firstDayTop: 0, firstDay: this.props.groups && this.props.groups[0] && this.props.groups[0].name || null, groups: this.props.groups||[] /*FIXME*/ };
}, },
componentWillReceiveProps: function(nextProps) componentWillReceiveProps: function(nextProps)
{ {
@ -76,7 +76,7 @@ var MessageList = React.createClass({
} }
this.setState({ this.setState({
firstDayTop: scrollTop, firstDayTop: scrollTop,
firstDay: groups[firstVisibleGrp].name, firstDay: firstVisibleGrp !== undefined ? groups[firstVisibleGrp].name : null,
firstGrp: firstVisibleGrp, firstGrp: firstVisibleGrp,
firstMsg: firstVisible, firstMsg: firstVisible,
lastGrp: lastVisibleGrp, lastGrp: lastVisibleGrp,
@ -183,7 +183,7 @@ var MessageList = React.createClass({
<div className="clear"></div> <div className="clear"></div>
</div> </div>
<div ref="scroll" className="listview" tabIndex="1" onScroll={self.changeFirstDay} onKeyDown={self.onListKeyDown}> <div ref="scroll" className="listview" tabIndex="1" onScroll={self.changeFirstDay} onKeyDown={self.onListKeyDown}>
<div ref="title" className="day first-day" style={{ top: self.state.firstDayTop }}>{self.state.firstDay}</div> <div ref="title" className="day first-day" style={{ top: self.state.firstDayTop, display: self.state.firstDay ? '' : 'none' }}>{self.state.firstDay||''}</div>
{(self.props.groups||[]).map(function(grp, i) { {(self.props.groups||[]).map(function(grp, i) {
if (i > 0) if (i > 0)
total++; total++;