diff --git a/src/components/RadioButtons.js b/src/components/RadioButtons.js index 65ca22054672..455f4dad1674 100644 --- a/src/components/RadioButtons.js +++ b/src/components/RadioButtons.js @@ -1,4 +1,4 @@ -import React from 'react'; +import React, {useState} from 'react'; import {View} from 'react-native'; import PropTypes from 'prop-types'; import _ from 'underscore'; @@ -18,35 +18,28 @@ const propTypes = { onPress: PropTypes.func.isRequired, }; -class RadioButtons extends React.Component { - constructor(props) { - super(props); +function RadioButtons(props) { + const [checkedValue, setCheckedValue] = useState(''); - this.state = { - checkedValue: '', - }; - } - - render() { - return ( - - {_.map(this.props.items, (item, index) => ( - { - this.setState({checkedValue: item.value}); - return this.props.onPress(item.value); - }} - label={item.label} - /> - ))} - - ); - } + return ( + + {_.map(props.items, (item, index) => ( + { + setCheckedValue(item.value); + return props.onPress(item.value); + }} + label={item.label} + /> + ))} + + ); } RadioButtons.propTypes = propTypes; +RadioButtons.displayName = 'RadioButtons'; export default RadioButtons;