-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInput.js
More file actions
36 lines (32 loc) · 904 Bytes
/
Input.js
File metadata and controls
36 lines (32 loc) · 904 Bytes
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
import { StyleSheet, Text, TextInput, View } from 'react-native';
export default function Input({ info, handleChange }) {
const keyboard = (name) => {
if (name.toLowerCase() === "phone") {
return "numeric";
} else {
return "default";
}
};
return (
<View>
{info.map(i => (
<View key={i.id}>
<Text style={styles.textInput}>{i.name}:</Text>
<TextInput style={styles.inputBox} onChangeText={(word) => { handleChange(i, word) }} value={i.value} keyboardType={keyboard(i.name)} />
</View>
))}
</View>
);
}
const styles = StyleSheet.create({
textInput: {
fontSize: 20,
paddingTop: 10
},
inputBox: {
height: 40,
borderColor: 'black',
borderWidth: 1,
padding: 10,
}
});