2
我尝试下载Material UI的一个示例并尝试使用Text Field。示例中的其他组件工作得很好(例如对话,按钮)。在TextField上,defaultValue是我尝试过的唯一支柱。感谢帮助。文本字段未知道具
我不断收到错误: 警告:未知道具hintText
,floatingLabelText
,floatingLabelFixed
标签上。
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import TextField from 'material-ui/TextField'
import withStyles from 'material-ui/styles/withStyles';
import withRoot from '../components/withRoot';
const styles = {
root: {
textAlign: 'center',
paddingTop: 200,
},
};
let hint = "I wish this would work.";
class Index extends Component {
render() {
return (
<div>
<TextField
hintText={hint}
floatingLabelText="Floating Label Text"
floatingLabelFixed={true}
/>
</div>
);
}
}
Index.propTypes = {
classes: PropTypes.object.isRequired,
};
export default withRoot(withStyles(styles)(Index));
您可以添加withRoot和withStyles HOCs的代码以及 –
尝试查看您使用的材料ui的版本。他们的测试版本有不同的源代码 –
我删除了withRoot和withStyles HOC,但它并未影响问题。 –