forked from battle0450/Final_Demo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPicker_Text.js
More file actions
92 lines (86 loc) · 1.98 KB
/
Picker_Text.js
File metadata and controls
92 lines (86 loc) · 1.98 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import React, { Component, PropTypes } from 'react';
import {
View,
StyleSheet,
Text,
Image,
Picker,
Item,
TextInput,
Button,
} from 'react-native';
const styles = StyleSheet.create({
container: {
flexDirection: 'row',
height: 100,
padding: 10,
backgroundColor: '#eee',
},
picker:{
justifyContent: 'center',
alignItems: 'center',
flex:0.5,
color:'gray',
marginRight:20,
marginLeft:20,
},
button:{
borderWidth:1,
borderRadius:40,
borderColor:'green',
}
})
export default class Picker_Text extends Component {
constructor(props) {
super(props);
data=['1號桌','2號桌','3號桌'];
this.state={
selected:"1號桌",
text:""
}
}
handleChangeText=(typedText)=>{
this.setState({text:typedText});
}
renderItem(){
items=[];
for(let item of data){
items.push(<Picker.Item key={item} label={item} value={item}/>)
}
return items;
}
render() {
return (
<View style={{flex:1}}>
<View style={{flex:0.4}}>
<Picker
style={styles.picker}
selectedValue={this.state.selected}
onValueChange={(value)=>this.setState({selected:value})}>
{this.renderItem()}
</Picker>
</View>
<View style={{flex:0.4,marginLeft:20,marginRight:20}}>
<Text style={{fontSize:20}}>點餐人數:</Text>
<TextInput
style={
{
height: 50
}
}
placeholder="在這裡輸入"
onChangeText={this.handleChangeText}
/>
</View>
<View style={{flex:0.2,marginLeft:40,marginRight:40}}>
<Button
onPress={()=>{}}
title="選擇菜色"
color='#FFBB66'
style={styles.button}
/>
</View>
</View>
);
}
}