2017-09-25 71 views
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)); 
+1

您可以添加withRoot和withStyles HOCs的代码以及 –

+0

尝试查看您使用的材料ui的版本。他们的测试版本有不同的源代码 –

+0

我删除了withRoot和withStyles HOC,但它并未影响问题。 –

回答

0

这是使用 “版本”: “1.0.0-beta.11”

我切换到最新的稳定版本,和一切正常!

+0

您使用的是什么材料版本? – rideronthestorm