-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPushPayload.js
More file actions
70 lines (65 loc) · 1.68 KB
/
Copy pathPushPayload.js
File metadata and controls
70 lines (65 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
'use strict';
import React, {Component} from 'react';
import AuthService from './AuthService';
import {
Text,
View,
ListView,
Image,
} from 'react-native';
import moment from 'moment';
export default class PushPayload extends Component < {} > {
constructor(props) {
super(props);
const ds = new ListView.DataSource({
rowHasChanged: (r1, r2) => r1 != r2
});
this.state = {
dataSource: ds.cloneWithRows(props.pushEvent.payload.commits),
pushEvent: props.pushEvent
}
}
renderRow(rowData) {
return (
<View style={{
flex: 1,
justifyContent: 'center',
}}>
<Text>{rowData.sha.substring(0, 6)} - {rowData.message}</Text>
</View>
);
}
render() {
return (
<View style={{
flex: 1,
paddingTop: 80,
justifyContent: 'flex-start',
alignItems: 'center'
}}>
<Image
source={{uri: this.state.pushEvent.actor.avatar_url}}
style={{
height: 120,
width: 120,
borderRadius: 60,
}}
/>
<Text style={{
paddingTop: 20,
paddingBottom: 20,
fontSize: 20,
}}>
{moment(this.state.pushEvent.created_at).fromNow()}
</Text>
<Text>{this.state.pushEvent.actor.login}</Text>
<Text>{this.state.pushEvent.payload.ref.replace('refs/heads/', '')}</Text>
<Text>at {this.state.pushEvent.repo.name}</Text>
<Text>{this.state.pushEvent.payload.commits.length} Commit(s)</Text>
<ListView
dataSource={this.state.dataSource}
renderRow={this.renderRow.bind(this)} />
</View>
);
}
}