diff --git a/package-lock.json b/package-lock.json
index b0303c0..8a1e1d0 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -10660,7 +10660,7 @@
},
"prop-types": {
"version": "15.7.2",
- "resolved": "http://registry.npm.taobao.org/prop-types/download/prop-types-15.7.2.tgz",
+ "resolved": "https://registry.npm.taobao.org/prop-types/download/prop-types-15.7.2.tgz",
"integrity": "sha1-UsQedbjIfnK52TYOAga5ncv/psU=",
"requires": {
"loose-envify": "^1.4.0",
diff --git a/src/component/notification/notification.js b/src/component/notification/notification.js
index acf8fe4..2f2bd15 100644
--- a/src/component/notification/notification.js
+++ b/src/component/notification/notification.js
@@ -1,5 +1,5 @@
import React, {Component} from 'react';
-import {StyleSheet, Text, View} from 'react-native';
+import {Image, StyleSheet, Text, View} from 'react-native';
import Ionicons from 'react-native-vector-icons/Ionicons';
import Touchable from '../touchable';
@@ -27,6 +27,8 @@ export default class Notification extends Component {
} else if(msg.type == 2) {
return this.renderFollow(msg);
+ } else if(msg.type == 3) {
+ return this.renderLike(msg);
}
}
@@ -34,6 +36,7 @@ export default class Notification extends Component {
}
renderComment(msg) {
+ console.log(msg);
const users = unique(msg.list.map(it => it.content.author.name)).join('、');
const body = `${users} 回复了你`;
@@ -59,6 +62,26 @@ export default class Notification extends Component {
)
}
+
+ renderLike(msg) {
+ console.log(msg);
+ const body = `${msg.content.user.name} 给了你一个创可贴`;
+
+ return (
+ this.props.onLikePress(msg)}>
+
+
+ {body}
+
+
+ )
+ }
}
const localStyle = StyleSheet.create({
@@ -76,5 +99,11 @@ const localStyle = StyleSheet.create({
text: {
flex: 1,
lineHeight: 20
- }
+ },
+ icon2: {
+ width: 14,
+ height: 14,
+ marginRight: 10,
+ marginTop: 4,
+ },
});
\ No newline at end of file
diff --git a/src/component/notification/notificationList.js b/src/component/notification/notificationList.js
index 4f774c7..82b8533 100644
--- a/src/component/notification/notificationList.js
+++ b/src/component/notification/notificationList.js
@@ -62,7 +62,7 @@ export default class NotificationList extends Component {
});
}
- } else if (v.type == 2) {
+ } else if (v.type == 2 || v.type == 3) {
ret.push(v);
}
@@ -149,6 +149,30 @@ export default class NotificationList extends Component {
}
}
+ _onLikePress(msg) {
+ Navigation.push(this.props.componentId, {
+ component: {
+ name: 'User',
+ options: {
+ bottomTabs: {
+ visible: false,
+
+ // hide bottom tab for android
+ drawBehind: true,
+ animate: true
+ }
+ },
+ passProps: {
+ user: msg.content.user
+ }
+ }
+ });
+
+ if(this.props.isSetRead) {
+ //this._setRead(msg);
+ }
+ }
+
render() {
let hasData = this.state.notifications && this.state.notifications.length > 0;
return hasData ? (
@@ -164,6 +188,7 @@ export default class NotificationList extends Component {
);
}}
diff --git a/src/util/api.js b/src/util/api.js
index 0cc45f5..999309d 100644
--- a/src/util/api.js
+++ b/src/util/api.js
@@ -248,7 +248,7 @@ async function addFollow(user_id) {
}
async function getMessages() {
- return call('GET', '/tip');
+ return callV2('GET', '/tips');
}
async function getMessagesHistory() {