0
私はActionSearchアイコンに適用しているスタイルを持っていますが、残念ながらそれは通過しません。MaterialUIのSVGIconにスタイルが適用されていませんReact
私は質問にもっと書くことはできませんが、私はそれがかなりシンプルだと思っていますが、Paperはスタイルを取得していますが、アイコンコンポーネントはありません。
なぜこのようなケースが考えられますか? SVGのアイコンは、このライブラリー内のコンポーネントとしてラップされているのでここで
import React from 'react';
import Paper from 'material-ui/Paper';
import TextField from 'material-ui/TextField';
import IconButton from 'material-ui/IconButton';
import ActionSearch from 'material-ui/svg-icons/action/search';
const stylePaper = {
width: 400,
margin: '40px auto',
paddingBottom: 10,
textAlign: 'center',
display: 'inline-block'
};
const styleIcon = {
position: 'absolute',
top: 20
};
export default class Home extends React.Component {
constructor(props) {
super(props);
this.state = {value: ''};
this.handleChange = this.handleChange.bind(this);
this.handleSubmit = this.handleSubmit.bind(this);
}
handleChange(event) {
this.setState({value: event.target.value});
}
handleSubmit(event) {
alert('A name was submitted: ' + this.state.value);
event.preventDefault();
}
render() {
return (
<form onSubmit={this.handleSubmit}>
<Paper zDepth={2} style={stylePaper} >
<TextField
hintText="Type in brand, position or industry"
/>
<IconButton>
<ActionSearch style={styleIcon} />
</IconButton>
</Paper>
</form>
);
}
}
がインスペクタ画像
あなたが正しいと思ったら、答えを編集する(反応ルータを追加する)ことを確認するとすぐに:) – AlexGvozden
それは、ありがとうございました! – AlexGvozden