SelectForm.js 1.36 KB
Newer Older
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
import React from 'react';
import { StyleSheet, Picker, View, Text } from 'react-native';
import { ListItem, Icon } from 'react-native-elements'

const SelectForm = (props) => {
    return (
        <View style={styles.container}>
            <View style={styles.inputTitleArea}>
                <Text style={styles.inputTitle}>{props.inputTitle}</Text>
            </View>
            <Picker
                selectedValue={props.selectedValue}
                style={styles.selectStyle}
                onValueChange={props.onValueChange}
            >
                {props.categories.map((index, item)=>{
                    return(
                        <Picker.Item label={item.category_name} value={item.category_name} />
                    )
                })}
            </Picker>
        </View>
    );
};

const styles = StyleSheet.create({
    container: {
        flexDirection: 'row',
        alignItems: "center",
        marginHorizontal: 10,
        marginVertical: 3,
        borderWidth: 1.5,
        borderStyle: "solid",
        borderColor: "#1467ff",
        borderRadius: 5,
        backgroundColor: "#f5f5f5",
    },
    inputTitleArea: {
        flex: 1,
    },
    inputTitle: {
        alignSelf: "center",
        color: "#1467ff",
        fontSize: 20,
    },
    selectStyle: {
        flex: 3,
        fontSize: 20,
    },
})

export default SelectForm