修复bug:

1.日记本详情页loading, 空内容提示
2.点击提醒到日记详情页时,提醒回复高亮,滚动到底部
This commit is contained in:
xuwenyang 2019-07-16 15:42:55 +08:00
parent 0e23c1b746
commit ffc12f3e74
6 changed files with 33 additions and 4 deletions

View file

@ -30,8 +30,13 @@ export default class Comment extends Component {
let isMyComment = this.state.isMyComment;
let expired = this.state.expired;
const isNewComment = this.props.newCommentIds != null
&& this.props.newCommentIds.some(it => it === comment.id);
const bgActive = isNewComment ? {backgroundColor: Color.textSelect} : null;
return (
<View>
<View style={bgActive}>
<View style={localStyle.box}>
<UserIcon iconUrl={user.iconUrl} onPress={this.props.onUserIconPress}></UserIcon>

View file

@ -149,6 +149,8 @@ export default class CommentList extends Component {
return (
<Touchable onPress={() => this._onCommentPress(item)}>
<Comment comment={item}
{...this.props}
isMyDiary={this.state.isMine}
isMyComment={selfInfo.id == item.user_id}
expired={this.state.expired}

View file

@ -32,7 +32,7 @@ const localStyle = StyleSheet.create({
position: 'absolute',
left: 0,
width: Api.DEVICE_WINDOW.width,
top: 200,
top: '50%',
justifyContent: 'center',
alignItems: 'center'
}

View file

@ -14,8 +14,10 @@ import moment from 'moment';
import Api from '../../util/api';
import Color from '../../style/color';
import Touchable from '../touchable';
import Loading from '../loading';
import DiaryBrief from '../diary/diaryBrief';
import {ListEmptyRefreshable} from '../listEmpty';
import NotebookDiaryData from '../../dataLoader/notebookDiaryData';
import {
ListFooterLoading,
@ -34,6 +36,8 @@ export default class NotebookDiaryList extends Component {
this.dataSource = new NotebookDiaryData();
this.state = {
mounting: true,
rawlist: [],
diaries: [],
@ -129,6 +133,7 @@ export default class NotebookDiaryList extends Component {
}).done(() => {
this.setState({
mounting: false,
refreshing: false
});
});
@ -210,6 +215,21 @@ export default class NotebookDiaryList extends Component {
return null;
}
if(this.state.refreshing) {
return (<Loading visible={true} color={Color.primary}></Loading>);
}
if(!this.state.mounting && (!this.state.diaries || this.state.diaries.length == 0)) {
return (
<ListEmptyRefreshable
error={this.state.refreshFailed}
message={'没有日记'}
onPress={this.refresh.bind(this)}
></ListEmptyRefreshable>
);
}
let expired = this.notebook.isExpired;
let isMine = this.isMine;

View file

@ -115,7 +115,9 @@ export default class NotificationList extends Component {
}
},
passProps: {
diaryId: msg.link_id
diaryId: msg.link_id,
newCommentIds: msg.list.map(it => it.content.comment_id),
needScrollToBottom: true
}
}
});

View file

@ -201,7 +201,7 @@ export default class DiaryDetailPage extends Component {
<ScrollView ref={(r)=>this.scroll = r}
style={{flex: 1}}
onContentSizeChange={(width, height) => {
if(this.state.needScrollToBottom) {
if(this.props.needScrollToBottom || this.state.needScrollToBottom) {
this.scroll.scrollTo({y: height});
this.setState({needScrollToBottom: false});
}