diff --git a/packages/ra-ui-materialui/src/input/DisabledInput.js b/packages/ra-ui-materialui/src/input/DisabledInput.js index 5f268d70db1..7758069885c 100644 --- a/packages/ra-ui-materialui/src/input/DisabledInput.js +++ b/packages/ra-ui-materialui/src/input/DisabledInput.js @@ -1,42 +1,46 @@ import React from 'react'; import PropTypes from 'prop-types'; import TextField from '@material-ui/core/TextField'; -import { addField, FieldTitle } from 'ra-core'; +import { useInput, FieldTitle } from 'ra-core'; import sanitizeRestProps from './sanitizeRestProps'; const DisabledInput = ({ - classes, - className, record, - input: { value }, label, resource, source, options, ...rest -}) => ( - } - className={className} - classes={classes} - {...options} - {...sanitizeRestProps(rest)} - /> -); +}) => { + const { + id, + input: { value }, + } = useInput({ + resource, + source, + }); + + return ( + + } + {...options} + {...sanitizeRestProps(rest)} + /> + ); +}; DisabledInput.propTypes = { - classes: PropTypes.object, - className: PropTypes.string, label: PropTypes.string, - input: PropTypes.object, options: PropTypes.object, - record: PropTypes.object, resource: PropTypes.string, source: PropTypes.string, }; -export default addField(DisabledInput); +export default DisabledInput;