Skip to content

Commit d7135b2

Browse files
committed
comment add page
1 parent cb11593 commit d7135b2

File tree

6 files changed

+105
-14
lines changed

6 files changed

+105
-14
lines changed

source/component/bar/blink.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class BlinkBar extends Component {
2525
let { blink, router, category, id } = this.props;
2626
if (router && category && id) {
2727
router.toCommentAdd({
28-
title: blink.Title,
28+
data: blink,
2929
category: category,
3030
id: id
3131
});

source/component/bar/postComment.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ class PostCommentBar extends Component {
2525
onCommentPress(){
2626
let { post, router, category, id } = this.props;
2727
if (router && category && id) {
28-
router.toPostComment({
29-
post: post,
28+
router.toCommentAdd({
29+
data: post,
3030
blogger: post.blogger,
3131
category: category,
3232
id: id

source/component/bar/question.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class QuestionBar extends Component {
2020
let { question, router, category, id } = this.props;
2121
if (router && category && id) {
2222
router.toCommentAdd({
23-
title: question.Title,
23+
data: question,
2424
category: category,
2525
id: id
2626
});

source/component/listview/postList.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ class PostList extends Component {
3434
}
3535

3636
renderListFooter() {
37-
console.info("renderListFooter");
38-
console.info(this.props.ui);
3937
let { ui } = this.props;
4038
if (ui.pagePending) {
4139
return <Spinner/>;

source/style/index.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export const StyleConfig = {
5555
border_width: 0.5,
5656
border_radius: 2,
5757
border_color: 'rgba(0, 0, 0, 0.05)',
58+
panel_bg_color: 'rgba(0, 0, 0, 0.02)',
5859
touchable_press_color: 'rgba(0, 0, 0, 0.05)',
5960

6061
screen_width: width,
@@ -226,7 +227,12 @@ export const ComponentStyles = StyleSheet.create({
226227

227228
btn_sm:{
228229
paddingVertical: StyleConfig.space_1,
229-
paddingHorizontal: StyleConfig.space_1
230+
paddingHorizontal: StyleConfig.space_1,
231+
width: 60
232+
},
233+
234+
btn_icon: {
235+
width: StyleConfig.icon_size * 2
230236
},
231237

232238
btn_block:{
@@ -407,7 +413,7 @@ export const ComponentStyles = StyleSheet.create({
407413
},
408414

409415
panel_container:{
410-
backgroundColor: 'rgba(0,0,0,0.02)',
416+
backgroundColor: StyleConfig.panel_bg_color,
411417
paddingVertical: StyleConfig.space_2,
412418
paddingHorizontal: StyleConfig.space_3,
413419
flexDirection:'row',
@@ -458,6 +464,10 @@ export const ComponentStyles = StyleSheet.create({
458464
fontSize: StyleConfig.font_sm,
459465
fontStyle: 'italic',
460466
fontWeight:'bold'
467+
},
468+
469+
panel_bg:{
470+
backgroundColor: StyleConfig.panel_bg_color
461471
}
462472
});
463473

source/view/commentAdd.js

Lines changed: 89 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
Image,
66
TextInput,
77
StyleSheet,
8-
TouchableHighlight
8+
TouchableOpacity
99
} from 'react-native';
1010

1111
import { bindActionCreators } from 'redux';
@@ -32,17 +32,51 @@ class CommentAddPage extends Component {
3232
}
3333

3434
onCommentSendPress(){
35-
35+
this.props.router.pop();
3636
}
3737

3838
renderNavbar(){
3939
return (
4040
<Navbar
4141
title={ navTitle }
4242
leftIconName = { "ios-arrow-round-back" }
43-
leftIconOnPress={ ()=>this.props.router.pop() }
44-
rightIconName = "ios-send-outline"
45-
rightIconOnPress={ ()=>this.onCommentSendPress() }/>
43+
leftIconOnPress={ ()=>this.props.router.pop() }/>
44+
)
45+
}
46+
47+
renderSourceAuthor(data){
48+
return (
49+
<View style={[ CommonStyles.flexRow, CommonStyles.flexItemsMiddle, CommonStyles.m_b_2]}>
50+
<Image ref={view => this.imgView=view}
51+
style={ [ ComponentStyles.avatar_mini, CommonStyles.m_r_2] }
52+
source={ {uri:data.Avatar} }>
53+
</Image>
54+
<Text style={ [ CommonStyles.text_gray, CommonStyles.font_xs ] }>
55+
{ data.Author }
56+
</Text>
57+
</View>
58+
)
59+
}
60+
61+
62+
renderSourceContent(data){
63+
let sourceContent = data.Title || data.Content;
64+
return (
65+
<View>
66+
<Text style={[ CommonStyles.text_black, CommonStyles.font_sm, CommonStyles.line_height_sm ]}>
67+
{ sourceContent }
68+
</Text>
69+
</View>
70+
)
71+
}
72+
73+
renderSource(){
74+
let { data } = this.props;
75+
return (
76+
<View style={[ CommonStyles.p_a_3, ComponentStyles.panel_bg ]}>
77+
{ this.renderSourceAuthor(data) }
78+
{ this.renderSourceContent(data) }
79+
</View>
4680
)
4781
}
4882

@@ -63,11 +97,60 @@ class CommentAddPage extends Component {
6397
)
6498
}
6599

100+
renderUserInfo(){
101+
return (
102+
<View style={[ CommonStyles.flexRow, CommonStyles.flexItemsMiddle ]}>
103+
<Image ref={view => this.imgView=view}
104+
style={ [ ComponentStyles.avatar_mini, CommonStyles.m_r_2] }
105+
source={ {uri: 'http://123.56.135.166/cnblog/public/img/common/author.jpg' } }>
106+
</Image>
107+
<Text style={ [ CommonStyles.text_gray, CommonStyles.font_xs ] }>
108+
愤怒的晃晃
109+
</Text>
110+
</View>
111+
)
112+
}
113+
114+
115+
renderSendButton(){
116+
return (
117+
<TouchableOpacity
118+
style={[ ComponentStyles.btn, ComponentStyles.btn_sm, ComponentStyles.btn_danger_outline ]}
119+
onPress={()=>this.onCommentSendPress()}>
120+
<Text style={[ComponentStyles.btn_text, CommonStyles.text_danger, CommonStyles.font_xs]}>
121+
提交
122+
</Text>
123+
</TouchableOpacity>
124+
)
125+
}
126+
127+
renderCommentOp(){
128+
return (
129+
<View style={[ CommonStyles.flexRow, CommonStyles.flexItemsMiddle, CommonStyles.flexItemsBetween, CommonStyles.p_a_3, ComponentStyles.panel_bg ]}>
130+
{ this.renderUserInfo() }
131+
{ this.renderSendButton() }
132+
</View>
133+
)
134+
}
135+
136+
renderCommentMessage(){
137+
return (
138+
<View style={[CommonStyles.p_a_4]}>
139+
<Text style={[ CommonStyles.font_xs, CommonStyles.text_gray, CommonStyles.text_center ]}>
140+
请输入评论内容
141+
</Text>
142+
</View>
143+
)
144+
}
145+
66146
render() {
67147
return (
68148
<View style={ ComponentStyles.container }>
69149
{ this.renderNavbar() }
150+
{ this.renderSource() }
70151
{ this.renderCommentInput() }
152+
{ this.renderCommentOp() }
153+
{ this.renderCommentMessage() }
71154
</View>
72155
);
73156
}
@@ -76,7 +159,7 @@ class CommentAddPage extends Component {
76159
const styles = StyleSheet.create({
77160
input:{
78161
width: StyleConfig.screen_width - ( StyleConfig.space_3 * 2 ),
79-
height: StyleConfig.screen_height / 3,
162+
height: StyleConfig.screen_height / 5,
80163
textAlign: "left",
81164
textAlignVertical: "top"
82165
}

0 commit comments

Comments
 (0)