mirror of
https://github.com/timepill/timepill-app.git
synced 2025-04-30 09:59:31 +08:00
tabbar 显示提醒红点
This commit is contained in:
parent
72a6064efe
commit
a19a7a6a53
3 changed files with 18 additions and 4 deletions
|
@ -63,7 +63,7 @@ export default class Notification extends Component {
|
|||
}
|
||||
|
||||
renderLike(msg) {
|
||||
const body = `${msg.content.user.name} 给了你一个创可贴`;
|
||||
const body = `${msg.content.user.name} 给了你一个OK绷`;
|
||||
|
||||
return (
|
||||
<Touchable key={msg.link_id} onPress={() => this.props.onLikePress(msg)}>
|
||||
|
@ -99,8 +99,8 @@ const localStyle = StyleSheet.create({
|
|||
lineHeight: 20
|
||||
},
|
||||
icon2: {
|
||||
width: 14,
|
||||
height: 14,
|
||||
width: 15,
|
||||
height: 15,
|
||||
marginRight: 10,
|
||||
marginTop: 4,
|
||||
},
|
||||
|
|
|
@ -33,9 +33,10 @@ export default class NotificationList extends Component {
|
|||
|
||||
(async () => {
|
||||
try {
|
||||
let notifications = await this.getMessages()
|
||||
let notifications = await this.getMessages();
|
||||
this.notificationsData = notifications;
|
||||
this.setNotifications(notifications);
|
||||
this.props.onRefreshed && this.props.onRefreshed(notifications.length);
|
||||
} catch (e) {
|
||||
this.setState({error: true});
|
||||
}
|
||||
|
|
|
@ -152,9 +152,21 @@ export default class NotificationPage extends Component {
|
|||
|
||||
|
||||
_onRefresh() {
|
||||
console.log(this.props.componentId);
|
||||
this.restartTipTimer().done();
|
||||
}
|
||||
|
||||
_onRefreshed(msgCount) {
|
||||
if(msgCount > 99) {
|
||||
msgCount = 99;
|
||||
}
|
||||
Navigation.mergeOptions(this.props.componentId, {
|
||||
bottomTab: {
|
||||
badge: msgCount > 0 ? msgCount.toString() : null,
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
refresh() {
|
||||
if(this.list) {
|
||||
this.list.refresh(false);
|
||||
|
@ -172,6 +184,7 @@ export default class NotificationPage extends Component {
|
|||
<NotificationList ref={(r) => {this.list = r}}
|
||||
isHistory={false}
|
||||
onRefresh={this._onRefresh.bind(this)}
|
||||
onRefreshed={this._onRefreshed.bind(this)}
|
||||
isSetRead={true}
|
||||
{...this.props}/>
|
||||
</View>
|
||||
|
|
Loading…
Reference in a new issue