Skip to content

Commit 748da55

Browse files
author
yubo5
committed
update
1 parent a6b4351 commit 748da55

25 files changed

+202
-1
lines changed

App.js

+1
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ class HomeScreen extends Component {
392392
}
393393

394394
componentWillUnmount() {
395+
Toast.showShortCenter('unregister...')
395396
this.unregisterListeners();
396397
}
397398
}

apk/RNWeChat-release.apk

11 MB
Binary file not shown.

app/screens/MomentScreen.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import CommonTitleBar from "../views/CommonTitleBar";
44
import CountEmitter from "../event/CountEmitter";
55
import StorageUtil from "../utils/StorageUtil";
66
import LoadingView from "../views/LoadingView";
7-
import MomentMenuView from "../views/MomentMenuView";
87
import { UIManager } from "NativeModules";
98
import ReplyPopWin from "../views/ReplyPopWin";
109
import Global from "../utils/Global";
@@ -13,6 +12,7 @@ import Base64Utils from "../utils/Base64";
1312
import TimeUtils from "../utils/TimeUtil";
1413
import Api from "../api/Api";
1514
import UserInfoUtil from "../utils/UserInfoUtil";
15+
import MomentMenuView from "../views/MomentMenuView";
1616

1717
import {
1818
ART,

app/views/MomentMenuView.js

+160
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
import React, {Component} from 'react';
2+
import StorageUtil from '../utils/StorageUtil';
3+
import Utils from '../utils/Utils';
4+
import Toast from '@remobile/react-native-toast';
5+
import Api from "../api/Api";
6+
7+
import {
8+
Dimensions,
9+
Image,
10+
Modal,
11+
PixelRatio,
12+
StyleSheet,
13+
Text,
14+
TouchableOpacity,
15+
View
16+
} from 'react-native';
17+
18+
const {width, height} = Dimensions.get('window');
19+
20+
export default class MomentMenuView extends Component {
21+
constructor(props) {
22+
super(props);
23+
this.state = {
24+
show: false,
25+
pageX: 0,
26+
pageY: 0,
27+
height: 0
28+
};
29+
StorageUtil.get('username', (error, object) => {
30+
if (!error && object != null) {
31+
this.setState({username: object.username});
32+
}
33+
});
34+
}
35+
36+
render() {
37+
return (
38+
<View style={[styles.modalContainer, {height: this.state.height}]}>
39+
<Modal transparent={true}
40+
visible={this.state.show}
41+
onRequestClose={() => this.closeModal()}>
42+
<TouchableOpacity style={[styles.modalContainer, {height: this.state.height}]}
43+
onPress={() => this.closeModal()}>
44+
<View style={[styles.container, {left: this.state.pageX - 200, top: this.state.pageY - 20}]}>
45+
<TouchableOpacity onPress={() => this.doFavor()}>
46+
<View style={styles.menuItemContainer}>
47+
<Image style={styles.menuItemImg} source={require('../../images/ic_moment_favor.png')}/>
48+
<Text style={styles.menuItemText}></Text>
49+
</View>
50+
</TouchableOpacity>
51+
<View style={styles.divider}/>
52+
<TouchableOpacity onPress={() => this.doComment()}>
53+
<View style={styles.menuItemContainer}>
54+
<Image style={styles.menuItemImg} source={require('../../images/ic_moment_comment.png')}/>
55+
<Text style={styles.menuItemText}>评论</Text>
56+
</View>
57+
</TouchableOpacity>
58+
</View>
59+
</TouchableOpacity>
60+
</Modal>
61+
</View>
62+
);
63+
}
64+
65+
doComment() {
66+
let callback2 = this.state.callback2;
67+
if (!Utils.isEmpty(callback2)) {
68+
callback2(this.state.momentId, this.state.momentUsername);
69+
}
70+
this.closeModal();
71+
}
72+
73+
doFavor() {
74+
let momentId = this.state.momentId;
75+
if (!Utils.isEmpty(momentId)) {
76+
let url = Api.MOMENT_FAVOR_URL;
77+
let username = this.state.username;
78+
let formData = new FormData();
79+
formData.append('username', username);
80+
formData.append('momentId', momentId);
81+
fetch(url, {method: 'POST', body: formData}).then((res) => res.json())
82+
83+
.then((json) => {
84+
if (!Utils.isEmpty(json)) {
85+
if (json.code == 1) {
86+
// 需要刷新页面
87+
let callback1 = this.state.callback1;
88+
if (!Utils.isEmpty(callback1)) {
89+
callback1(json.msg);
90+
}
91+
} else {
92+
Toast.showShortCenter(json.msg);
93+
}
94+
}
95+
}).catch((e) => {
96+
Toast.showShortCenter(e.toString());
97+
})
98+
}
99+
this.closeModal();
100+
}
101+
102+
closeModal() {
103+
this.setState({show: false, height: 0});
104+
}
105+
106+
showModal(pageX, pageY, momentId, momentUsername, callback1, callback2) {
107+
this.setState({
108+
pageX: pageX,
109+
pageY: pageY,
110+
height: height,
111+
show: true,
112+
momentId: momentId,
113+
momentUsername: momentUsername,
114+
callback1: callback1,
115+
callback2: callback2
116+
});
117+
}
118+
}
119+
120+
const styles = StyleSheet.create({
121+
modalContainer: {
122+
width: width,
123+
},
124+
container: {
125+
backgroundColor: '#393A3E',
126+
borderRadius: 2,
127+
flexDirection: 'row',
128+
justifyContent: 'center',
129+
alignItems: 'center',
130+
width: 180,
131+
padding: 5,
132+
height: 35,
133+
position: 'absolute',
134+
left: 230,
135+
top: 500
136+
},
137+
divider: {
138+
width: 1 / PixelRatio.get(),
139+
marginLeft: 20,
140+
marginRight: 20,
141+
height: 25,
142+
backgroundColor: '#DDDDDD'
143+
},
144+
menuItemContainer: {
145+
flex: 1,
146+
flexDirection: 'row',
147+
alignItems: 'center',
148+
justifyContent: 'center',
149+
},
150+
menuItemImg: {
151+
width: 20,
152+
height: 20,
153+
marginTop: 10,
154+
marginBottom: 10,
155+
},
156+
menuItemText: {
157+
color: '#FFFFFF',
158+
fontSize: 15
159+
}
160+
})

screenshots/01.png

173 KB
Loading

screenshots/02.png

194 KB
Loading

screenshots/03.png

211 KB
Loading

screenshots/04.png

205 KB
Loading

screenshots/05.png

76.7 KB
Loading

screenshots/06.png

62.5 KB
Loading

screenshots/07.png

118 KB
Loading

screenshots/08.png

118 KB
Loading

screenshots/ios01.png

148 KB
Loading

screenshots/ios02.png

21.4 KB
Loading

screenshots/ios03.png

65.7 KB
Loading

screenshots/ios04.png

39.5 KB
Loading

screenshots/ios05.png

45.7 KB
Loading

screenshots/ios06.png

39.9 KB
Loading

screenshots/ios07.png

141 KB
Loading

screenshots/ios08.png

23.2 KB
Loading

screenshots/ios09.png

42.5 KB
Loading

screenshots/ios_settings.png

180 KB
Loading

screenshots/new.jpg

47.4 KB
Loading

screenshots/rnwechat.png

2.21 KB
Loading

screenshots/test.html

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<div>
2+
<image src="./Android/android01.jpg" />
3+
<image src="./Android/android02.jpg" />
4+
<image src="./Android/android03.jpg" />
5+
</div>
6+
<div>
7+
<image src="./Android/android04.jpg" />
8+
<image src="./Android/android05.jpg" />
9+
<image src="./Android/android06.jpg" />
10+
</div>
11+
<div>
12+
<image src="./Android/android07.jpg" />
13+
<image src="./Android/android08.jpg" />
14+
<image src="./Android/android09.jpg" />
15+
</div>
16+
<div>
17+
<image src="./Android/android10.jpg" />
18+
<image src="./Android/android11.jpg" />
19+
<image src="./Android/android12.jpg" />
20+
</div>
21+
<div>
22+
<image src="./iOS/ios01.png" />
23+
<image src="./iOS/ios02.png" />
24+
<image src="./iOS/ios03.png" />
25+
</div>
26+
<div>
27+
<image src="./iOS/ios04.png" />
28+
<image src="./iOS/ios05.png" />
29+
<image src="./iOS/ios06.png" />
30+
</div>
31+
<div>
32+
<image src="./iOS/ios07.png" />
33+
<image src="./iOS/ios08.png" />
34+
<image src="./iOS/ios09.png" />
35+
</div>
36+
<div>
37+
<image src="./iOS/ios10.png" />
38+
<image src="./iOS/ios11.png" />
39+
<image src="./iOS/ios12.png" />
40+
</div>

0 commit comments

Comments
 (0)