import React from 'react' import PropTypes from 'prop-types' import { StyleSheet, TouchableOpacity, View } from 'react-native' import AppText from '../common/app-text' import { Colors, Containers } from '../../styles' const SelectBoxGroup = ({ labels, optionsState, onSelect }) => { return ( {Object.keys(labels).map((key) => { const isActive = optionsState[key] const boxStyle = [styles.box, isActive && styles.boxActive] const textStyle = [styles.text, isActive && styles.textActive] return ( onSelect(key)} style={boxStyle} > {labels[key]} ) })} ) } SelectBoxGroup.propTypes = { labels: PropTypes.object.isRequired, onSelect: PropTypes.func.isRequired, optionsState: PropTypes.object.isRequired, } const styles = StyleSheet.create({ box: { ...Containers.box, }, boxActive: { ...Containers.boxActive, }, container: { ...Containers.selectGroupContainer, }, text: { color: Colors.orange, }, textActive: { color: 'white', }, }) export default SelectBoxGroup