2016-01-17 52 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',但應該是對象,複合了問題。

現在都好。