ButtonsForm.js 1.04 KB
Newer Older
1
2
3
4
5
import React from 'react';
import { ButtonGroup } from 'react-native-elements';
import { StyleSheet, Text } from 'react-native';

const ButtonsForm = (props) => {
6
    const components = [];
7

8
9
10
    for (let i = 0; i < props.group.length ; i++) {
        components[i] = { element: () => <Text>{props.group[i]}</Text> }
    }
11
12
13
14
15

    return (
        <ButtonGroup
            onPress={props.onPress}
            selectedIndex={props.selectedIndex}
16
            buttons={components}
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
            containerStyle={style.container}
            selectedButtonStyle={style.selectedButton}
            selectedTextStyle={style.selectedText}
        />
    );
};

const style = StyleSheet.create({
    container: {
        height: 50,
        flexDirection: 'row',
        alignItems: "center",
        backgroundColor: "#f5f5f5",
    },
    text: {
        color: "#808080",
        fontSize: 24
    },
    selectedButton: {
        backgroundColor: "#adadad",
    },
    selectedText: {
        color: "#1467ff",
        fontWeight: "bold",
    },
})

YoonDongMin's avatar
DongM    
YoonDongMin committed
44
export default ButtonsForm