import React from 'react'; import PropTypes from 'prop-types'; import { Button, DialogTitle, DialogContent, DialogActions, Dialog, Radio, RadioGroup, FormControlLabel, } from '@material-ui/core'; const options = [ 'None', 'Atria', 'Callisto', 'Dione', 'Ganymede', 'Hangouts Call', 'Luna', 'Oberon', 'Phobos', 'Pyxis', 'Sedna', 'Titania', 'Triton', 'Umbriel', ]; class ConfirmationDialog extends React.Component { constructor(props, context) { super(props, context); this.state.value = this.props.value; } state = {}; componentWillReceiveProps(nextProps) { if (nextProps.value !== this.props.value) { this.setState({ value: nextProps.value }); } } radioGroup = null; handleEntering = () => { this.radioGroup.focus(); }; handleCancel = () => { this.props.onClose(this.props.value); }; handleOk = () => { this.props.onClose(this.state.value); }; handleChange = (event, value) => { this.setState({ value }); }; render() { const { value, ...other } = this.props; return ( Phone Ringtone { this.radioGroup = node; }} aria-label="ringtone" name="ringtone" value={this.state.value} onChange={this.handleChange} > {options.map(option => ( } label={option} /> ))} ); } } ConfirmationDialog.propTypes = { onClose: PropTypes.func.isRequired, value: PropTypes.string.isRequired, }; export default ConfirmationDialog;