私はコンポーネントがあります。componentDidMountでcomponentDidMountから要素をスタイルする方法は?
render: function() {
const item = this.props.item
return (
<div style={{marginTop: '20px', display: 'flex'}}>
{item.get('images').map((url, i) =>
<Thumbnail href='#' src={stripUrl(url)} onClick={() => this.flky.select(i)} />
´ )}
</div>
´ )
}
を、私はthumnailsの1を対象とし、それのスタイルを更新したい、私は私がこれをどのように行うことができ、サムネイルが持っているもののインデックスを知っていますか?あなたが直接あなたが行うことができ、すべてがその状態またはそのプロパティを変更され、コンポーネントが描画される方法を変更することはできません例えば
// constructor
this.state = { mounted: false };
// componentDidMount
this.setState({ mounted: true });
// render
<View style={ this.state.mounted ? styles.style1 : styles.style2 ></View>