mirror of
https://github.com/timepill/timepill-app.git
synced 2025-04-30 09:59:31 +08:00
修复bug:
1.日记本详情页loading, 空内容提示 2.点击提醒到日记详情页时,提醒回复高亮,滚动到底部
This commit is contained in:
parent
0e23c1b746
commit
ffc12f3e74
6 changed files with 33 additions and 4 deletions
|
@ -30,8 +30,13 @@ export default class Comment extends Component {
|
||||||
let isMyComment = this.state.isMyComment;
|
let isMyComment = this.state.isMyComment;
|
||||||
let expired = this.state.expired;
|
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 (
|
return (
|
||||||
<View>
|
<View style={bgActive}>
|
||||||
<View style={localStyle.box}>
|
<View style={localStyle.box}>
|
||||||
<UserIcon iconUrl={user.iconUrl} onPress={this.props.onUserIconPress}></UserIcon>
|
<UserIcon iconUrl={user.iconUrl} onPress={this.props.onUserIconPress}></UserIcon>
|
||||||
|
|
||||||
|
|
|
@ -149,6 +149,8 @@ export default class CommentList extends Component {
|
||||||
return (
|
return (
|
||||||
<Touchable onPress={() => this._onCommentPress(item)}>
|
<Touchable onPress={() => this._onCommentPress(item)}>
|
||||||
<Comment comment={item}
|
<Comment comment={item}
|
||||||
|
{...this.props}
|
||||||
|
|
||||||
isMyDiary={this.state.isMine}
|
isMyDiary={this.state.isMine}
|
||||||
isMyComment={selfInfo.id == item.user_id}
|
isMyComment={selfInfo.id == item.user_id}
|
||||||
expired={this.state.expired}
|
expired={this.state.expired}
|
||||||
|
|
|
@ -32,7 +32,7 @@ const localStyle = StyleSheet.create({
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
left: 0,
|
left: 0,
|
||||||
width: Api.DEVICE_WINDOW.width,
|
width: Api.DEVICE_WINDOW.width,
|
||||||
top: 200,
|
top: '50%',
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
alignItems: 'center'
|
alignItems: 'center'
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,8 +14,10 @@ import moment from 'moment';
|
||||||
import Api from '../../util/api';
|
import Api from '../../util/api';
|
||||||
import Color from '../../style/color';
|
import Color from '../../style/color';
|
||||||
import Touchable from '../touchable';
|
import Touchable from '../touchable';
|
||||||
|
import Loading from '../loading';
|
||||||
|
|
||||||
import DiaryBrief from '../diary/diaryBrief';
|
import DiaryBrief from '../diary/diaryBrief';
|
||||||
|
import {ListEmptyRefreshable} from '../listEmpty';
|
||||||
import NotebookDiaryData from '../../dataLoader/notebookDiaryData';
|
import NotebookDiaryData from '../../dataLoader/notebookDiaryData';
|
||||||
import {
|
import {
|
||||||
ListFooterLoading,
|
ListFooterLoading,
|
||||||
|
@ -34,6 +36,8 @@ export default class NotebookDiaryList extends Component {
|
||||||
this.dataSource = new NotebookDiaryData();
|
this.dataSource = new NotebookDiaryData();
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
|
mounting: true,
|
||||||
|
|
||||||
rawlist: [],
|
rawlist: [],
|
||||||
diaries: [],
|
diaries: [],
|
||||||
|
|
||||||
|
@ -129,6 +133,7 @@ export default class NotebookDiaryList extends Component {
|
||||||
|
|
||||||
}).done(() => {
|
}).done(() => {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
mounting: false,
|
||||||
refreshing: false
|
refreshing: false
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -210,6 +215,21 @@ export default class NotebookDiaryList extends Component {
|
||||||
return null;
|
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 expired = this.notebook.isExpired;
|
||||||
let isMine = this.isMine;
|
let isMine = this.isMine;
|
||||||
|
|
||||||
|
|
|
@ -115,7 +115,9 @@ export default class NotificationList extends Component {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
passProps: {
|
passProps: {
|
||||||
diaryId: msg.link_id
|
diaryId: msg.link_id,
|
||||||
|
newCommentIds: msg.list.map(it => it.content.comment_id),
|
||||||
|
needScrollToBottom: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -201,7 +201,7 @@ export default class DiaryDetailPage extends Component {
|
||||||
<ScrollView ref={(r)=>this.scroll = r}
|
<ScrollView ref={(r)=>this.scroll = r}
|
||||||
style={{flex: 1}}
|
style={{flex: 1}}
|
||||||
onContentSizeChange={(width, height) => {
|
onContentSizeChange={(width, height) => {
|
||||||
if(this.state.needScrollToBottom) {
|
if(this.props.needScrollToBottom || this.state.needScrollToBottom) {
|
||||||
this.scroll.scrollTo({y: height});
|
this.scroll.scrollTo({y: height});
|
||||||
this.setState({needScrollToBottom: false});
|
this.setState({needScrollToBottom: false});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue