11import React , { Component } from 'react' ;
2- import { ActivityIndicator } from 'react-native' ;
2+ import {
3+ Text ,
4+ ActivityIndicator ,
5+ TouchableHighlight ,
6+ } from 'react-native' ;
37import { ListItem } from 'react-native-elements' ;
8+
49import Parse from 'parse-diff' ;
510import styled from 'styled-components' ;
611
@@ -56,8 +61,9 @@ const IssueTitle = styled(ListItem).attrs({
5661
5762const DiffBlocksContainer = styled . View `
5863 flex-direction: row;
59- align-items: center;
60- justify-content: flex-end;
64+ align-items: stretch;
65+ justify-content: space-between;
66+ padding-left: 10;
6167 padding-right: 10;
6268 padding-bottom: 10;
6369` ;
@@ -85,16 +91,35 @@ export class IssueDescription extends Component {
8591 issue : Object ,
8692 repository : Object ,
8793 diff : string ,
94+ commits : Array ,
8895 isMergeable : boolean ,
8996 isMerged : boolean ,
9097 isPendingDiff : boolean ,
98+ isPendingCommit : boolean ,
9199 isPendingCheckMerge : boolean ,
92100 onRepositoryPress : Function ,
93101 userHasPushPermission : boolean ,
94102 locale : string ,
95103 navigation : Object ,
96104 } ;
97105
106+ navigateToCommitList = ( ) => {
107+ const { commits, locale } = this . props ;
108+
109+ if ( commits . length > 1 ) {
110+ this . props . navigation . navigate ( 'CommitList' , {
111+ title : t ( 'Commits' , locale ) ,
112+ commits,
113+ locale,
114+ } ) ;
115+ } else {
116+ this . props . navigation . navigate ( 'Commit' , {
117+ commit : commits [ 0 ] ,
118+ title : commits [ 0 ] . sha . substring ( 0 , 7 ) ,
119+ } ) ;
120+ }
121+ } ;
122+
98123 renderLabelButtons = labels => {
99124 return labels
100125 . slice ( 0 , 3 )
@@ -105,10 +130,12 @@ export class IssueDescription extends Component {
105130 const {
106131 diff,
107132 issue,
133+ commits,
108134 repository,
109135 isMergeable,
110136 isMerged,
111137 isPendingDiff,
138+ isPendingCommit,
112139 isPendingCheckMerge,
113140 onRepositoryPress,
114141 userHasPushPermission,
@@ -168,10 +195,23 @@ export class IssueDescription extends Component {
168195
169196 { issue . pull_request && (
170197 < DiffBlocksContainer >
198+ { isPendingCommit && (
199+ < ActivityIndicator animating = { isPendingCommit } size = "small" />
200+ ) }
201+
171202 { isPendingDiff && (
172203 < ActivityIndicator animating = { isPendingDiff } size = "small" />
173204 ) }
174205
206+ { ! isPendingCommit && (
207+ < TouchableHighlight
208+ onPress = { ( ) => this . navigateToCommitList ( ) }
209+ underlayColor = { colors . greyLight }
210+ >
211+ < Text > { `${ commits . length } commits` } </ Text >
212+ </ TouchableHighlight >
213+ ) }
214+
175215 { ! isPendingDiff &&
176216 ( lineAdditions !== 0 || lineDeletions !== 0 ) && (
177217 < DiffBlocks
0 commit comments