-
Notifications
You must be signed in to change notification settings - Fork 0
/
TextBox.js
40 lines (34 loc) · 945 Bytes
/
TextBox.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
import React, {Component} from 'react';
import {TextInput, View, Text} from 'react-native';
import {KeyboardAwareScrollView} from 'react-native-keyboard-aware-scroll-view'
const TextInputStyle = {
margin: 5,
height: 40,
width: 350,
padding: 5,
borderColor: 'grey',
borderWidth: 1
}
const TextStyle = {
margin: 5,
marginBottom:0
}
const ViewStyle = {
backgroundColor : '#eee',
borderBottomColor : '#ccc',
borderBottomWidth : 1
}
class TextBox extends Component {
constructor(props) {
super(props)
}
render() {
let attr = this.props.element;
return (<View style={ViewStyle} key={attr.key}>
<Text style={TextStyle}>{attr.label}</Text>
<TextInput underlineColorAndroid="transparent" value={this.props.state[attr.key]} placeholder={attr.placeholder}
style={TextInputStyle} onChangeText={(text) => this.props.changeHandler(text,attr.key)}/>
</View>)
}
}
export default TextBox;