-
Notifications
You must be signed in to change notification settings - Fork 0
/
project.ios.js
executable file
·142 lines (133 loc) · 3.62 KB
/
project.ios.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
import React, { Component } from "react";
import {
Text,
TextInput,
Button,
StyleSheet,
ScrollView,
FlatList,
TouchableOpacity,
TouchableHighlight,
Modal,
View,
} from "react-native";
import { ModalWindow } from "./modal.js";
export class ProjectScreen extends Component {
constructor(props) {
super(props);
this.state = {
prjs: [
{key: "테스트"},
{key: "군함도"},
],
addPrj: "",
modalVisible: false,
};
this.setModalVisible = this.setModalVisible.bind(this);
}
static navigationOptions = ({navigation}) => ({
title: "프로젝트",
headerRight: (
<Button
title="추가"
onPress={() => {
navigation.state.params.handleSetModalVisible(true)
}}
/>
),
});
setModalVisible(visible) {
this.setState({modalVisible:visible})
}
componentDidMount() {
this.props.navigation.setParams({handleSetModalVisible: this.setModalVisible})
}
render() {
const { navigate } = this.props.navigation;
return (
<View style={{flex: 1, backgroundColor:"#546e7a"}}>
<ModalWindow
visible={this.state.modalVisible}
title="프로젝트 생성"
onPressCancel={() => {
this.setModalVisible(false)
}}
onPressOK={() => {
var {prjs} = this.state;
for (var i = 0; i < prjs.length; i++) {
if (prjs[i].key == this.state.addPrj) {
return;
}
}
prjs.push({key: this.state.addPrj});
this.setState({addPrj: ""});
this.setState({prjs});
this.setModalVisible(false);
}}
>
<Text style={{fontSize:25, color:"white"}}>생성할 프로젝트의 이름을 적어주세요.</Text>
<TextInput
value={this.state.addPrj}
style={{height:50, fontSize:30, marginTop:40, borderRadius:2, backgroundColor:"white"}}
onChangeText={(addPrj) => this.setState({addPrj})}
/>
</ModalWindow>
<FlatList
data={this.state.prjs}
extraData={this.state}
renderItem={({item}) => (
<TouchableOpacity
style={styles.row}
onPress={() => {
navigate('CutSelection', {project:item.key})
}}
>
<View style={{flex:1, flexDirection:"row"}}>
<View style={{flex:1, margin:15, paddingLeft:20, justifyContent:"center"}}>
<Text style={styles.normalText}>{item.key}</Text>
</View>
<TouchableOpacity
style={{margin:15, width:90, alignItems:"center", justifyContent: "center", borderRadius:3, borderWidth:1, borderColor:"#112233"}}
onPress={() => navigate('ProjectConfig', {project: item.key})}
>
<Text style={styles.projectConfigButtonText}>설정 ></Text>
</TouchableOpacity>
</View>
</TouchableOpacity>
)}
/>
</View>
);
}
}
const styles = StyleSheet.create({
category: {
backgroundColor: "transparent",
flexDirection: "row",
padding: 10,
marginTop:12,
marginBottom:6,
},
row: {
height: 75,
backgroundColor: "#29434e",
flexDirection: "row",
margin: 25,
marginTop: 30,
marginBottom: 0,
borderRadius: 5,
},
normalText: {
fontSize: 30,
color: "white",
},
projectConfigButtonText: {
fontSize: 24,
color: "lightgrey",
},
background: {
flex: 1,
height: 350,
backgroundColor: "#546e7a",
}
});