2016-01-17 51 views
0

appBar iconStyleRight语法错误

render() { 
    return <AppBar style={{ position: "fixed" }} title={<span>my Title</span>} 

     iconElementLeft={<IconButton><NavigationMenu /></IconButton>} 
     iconStyleRight={{color:"red"}} 
     iconElementRight={<IconButton><span className = "material-icons">account_circle</span></IconButton>} 
     /> 
} 

但iconStyleRight是给我的错误

Type '{ [x: number]: undefined; color: any; }' is not assignable to type 'string' 

不知道为什么。我尝试了很多组合,包括将style添加到<span>元素,这被忽略。

希望能够使正确的图标显示为红色的正确语法,以便我能够理解如何将样式应用于我的图标。

回答

0

事实证明,解决方案是设置IconButton组件的iconStyle属性。

同样在我目前在material-ui.d.ts中的环境中,iconStyleRight属性的typedef被错误地设置为'string',但应该是对象,复合了问题。

现在都好。