-
Notifications
You must be signed in to change notification settings - Fork 427
/
Copy pathReleasePage.js
109 lines (93 loc) · 2.9 KB
/
ReleasePage.js
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/**
* Created by guoshuyu on 2017/11/10.
*/
import React, {Component,} from 'react';
import {
View, InteractionManager, StatusBar, Dimensions,
} from 'react-native';
import styles from "../style"
import * as Constant from "../style/constant"
import I18n from '../style/i18n'
import {TabView, TabBar,} from 'react-native-tab-view';
import ListPage from "./ListPage";
/**
* 仓库发布列表
*/
class ReleasePage extends Component {
constructor(props) {
super(props);
this.page = 2;
this._refresh = this._refresh.bind(this);
this.state = {
index: 0,
routes: [
{key: '1', title: I18n('reposRelease')},
{key: '2', title: I18n('reposTag')},
],
}
}
componentDidMount() {
InteractionManager.runAfterInteractions(() => {
this._refresh();
});
}
componentWillUnmount() {
}
_refresh() {
}
_handleIndexChange = index => this.setState({index});
_renderHeader = props =>
<TabBar {...props}
style={{backgroundColor: Constant.primaryColor}}
labelStyle={{color: Constant.white}}
indicatorStyle={{backgroundColor: Constant.miWhite}}
/>;
_renderScene = ({route}) => {
switch (route.key) {
case '1':
return (
<ListPage
dataType={'repo_release'}
showType={'release'}
currentUser={this.props.ownerName}
currentRepository={this.props.repositoryName}
/>
);
case '2':
return (
<ListPage
dataType={'repo_tag'}
showType={'release'}
currentUser={this.props.ownerName}
currentRepository={this.props.repositoryName}
/>
);
default:
return null;
}
};
render() {
return (
<View style={styles.mainBox}>
<StatusBar hidden={false} backgroundColor={'transparent'} translucent barStyle={'light-content'}/>
<TabView
style={{
flex: 1,
}}
lazy={true}
swipeEnabled={false}
navigationState={this.state}
renderScene={this._renderScene.bind(this)}
renderTabBar={this._renderHeader}
onIndexChange={this._handleIndexChange}
initialLayout={{
height: 0,
width: Dimensions.get('window').width,
}}
/>
</View>
)
}
}
ReleasePage.defaultProps = {};
export default ReleasePage