@@ -13,6 +13,7 @@ var markdown = require("markdown").markdown
13
13
var Return = require ( '../components/overlay/Return' )
14
14
var CommentHtml = require ( '../components/htmlRender/CommentHtml' )
15
15
var CommentUp = require ( '../components/comment/CommentUp' )
16
+ var Nav = require ( '../components/Nav' )
16
17
17
18
var TopicService = require ( '../services/TopicService' )
18
19
var genColor = require ( '../util/genColor' )
@@ -222,35 +223,13 @@ class Comments extends Component {
222
223
}
223
224
224
225
225
- _onReturnPress ( ) {
226
- this . props . router . pop ( )
227
- }
228
-
229
-
230
- _onReturnToTopic ( ) {
231
- this . props . router . toTopic ( {
232
- topic : this . topic
233
- } )
234
- }
235
-
236
-
237
226
_onAuthorImgPress ( authorName ) {
238
227
this . props . router . toUser ( {
239
228
userName : authorName
240
229
} )
241
230
}
242
231
243
232
244
- _onCommentTitlePress ( ) {
245
- this . _listView . setNativeProps ( {
246
- contentOffset : {
247
- x : 0 ,
248
- y : 0
249
- }
250
- } )
251
- }
252
-
253
-
254
233
renderRow ( comment , sectionID , rowID , highlightRow ) {
255
234
var authorName = comment . author . loginname
256
235
var domain = config . domain
@@ -431,47 +410,48 @@ class Comments extends Component {
431
410
432
411
render ( ) {
433
412
var count = this . state . ds . getRowCount ( )
434
- var returnToTopic = (
435
- < TouchableHighlight
436
- onPress = { this . _onReturnToTopic . bind ( this ) }
437
- underlayColor = 'rgba(0,0,0,0.1)'
438
- style = { styles . navToTopic } >
439
- < Text style = { styles . navReturnText } >
440
- 正文
441
- </ Text >
442
- </ TouchableHighlight >
443
- )
444
413
445
- return (
446
- < View style = { styles . container } >
447
- < View
448
- ref = { view => this . nav = view }
449
- style = { styles . nav } >
450
- < TouchableHighlight
451
- onPress = { this . _onReturnPress . bind ( this ) }
452
- underlayColor = 'rgba(0,0,0,0.1)'
453
- style = { styles . navReturn } >
454
- < Text style = { styles . navReturnText } >
455
- 返回
456
- </ Text >
457
- </ TouchableHighlight >
414
+ var router = this . props . router
458
415
459
- < TouchableOpacity
460
- onPress = { this . _onCommentTitlePress . bind ( this ) }
461
- style = { styles . navTitle } >
462
- < Text style = { styles . titleText } >
463
- 评论
464
- < Text style = { styles . countText } >
465
- { ' ' + count . toString ( ) }
466
- </ Text >
467
- </ Text >
468
- </ TouchableOpacity >
416
+ var navs = {
417
+ Left : {
418
+ text : '返回' ,
419
+ onPress : ( ) => {
420
+ router . pop ( )
421
+ }
422
+ } ,
423
+ Center : {
424
+ text : '评论 ' + count ,
425
+ onPress : ( ) => {
426
+ this . _listView . setNativeProps ( {
427
+ contentOffset : {
428
+ x : 0 ,
429
+ y : 0
430
+ }
431
+ } )
432
+ }
433
+ }
434
+ }
469
435
470
- {
471
- ( this . state . didFocus && this . props . reply && this . state . isLoaded ) ? returnToTopic : null
436
+ if ( this . state . didFocus && this . props . reply && this . state . isLoaded ) {
437
+ navs = {
438
+ ...navs ,
439
+ Right : {
440
+ text : '正文' ,
441
+ onPress : ( ) => {
442
+ router . toTopic ( {
443
+ topic : this . topic
444
+ } )
472
445
}
446
+ }
447
+ }
448
+ }
473
449
474
- </ View >
450
+ return (
451
+ < View style = { styles . container } >
452
+ < Nav
453
+ navs = { navs }
454
+ > </ Nav >
475
455
476
456
< View
477
457
ref = { view => this . commentsView = view }
@@ -507,47 +487,12 @@ var styles = StyleSheet.create({
507
487
backgroundColor : 'white' ,
508
488
height : height
509
489
} ,
510
- nav : {
511
- height : navHeight ,
512
- width : width ,
513
- borderBottomColor : 'rgba(0,0,0,0.03)' ,
514
- borderBottomWidth : 1 ,
515
- flexDirection : 'row' ,
516
- justifyContent : 'center' ,
517
- alignItems : 'center'
518
- } ,
519
-
520
- navReturn : {
521
- height : navHeight ,
522
- position : 'absolute' ,
523
- left : 0 ,
524
- top : 0 ,
525
- paddingLeft : 15 ,
526
- paddingRight : 15
527
- } ,
528
-
529
- navToTopic : {
530
- height : navHeight ,
531
- position : 'absolute' ,
532
- right : 0 ,
533
- top : 0 ,
534
- paddingLeft : 15 ,
535
- paddingRight : 15
536
- } ,
537
- navReturnText : {
538
- lineHeight : navHeight - 20 ,
539
- fontSize : 16
540
- } ,
541
490
542
491
titleText : {
543
492
color : 'rgba(0,0,0,0.7)' ,
544
493
fontSize : 16
545
494
} ,
546
495
547
- countText : {
548
- color : 'rgba(0,0,0,0.45)'
549
- } ,
550
-
551
496
comments : {
552
497
//marginTop: 20,
553
498
width : width ,
0 commit comments