|
|
@ -8,12 +8,6 @@ import { validateColor } from '../lib/colors'
|
|
|
|
import { capitalize, stringifyRGBA } from '../lib/util'
|
|
|
|
import { capitalize, stringifyRGBA } from '../lib/util'
|
|
|
|
|
|
|
|
|
|
|
|
class BackgroundSelect extends React.PureComponent {
|
|
|
|
class BackgroundSelect extends React.PureComponent {
|
|
|
|
state = { mounted: false }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
|
|
|
|
this.setState({ mounted: true })
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
selectTab = name => {
|
|
|
|
selectTab = name => {
|
|
|
|
if (this.props.mode !== name) {
|
|
|
|
if (this.props.mode !== name) {
|
|
|
|
this.props.onChange({ backgroundMode: name })
|
|
|
|
this.props.onChange({ backgroundMode: name })
|
|
|
@ -24,7 +18,6 @@ class BackgroundSelect extends React.PureComponent {
|
|
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
render() {
|
|
|
|
const { color, mode, image, onChange, aspectRatio, isVisible, toggleVisibility } = this.props
|
|
|
|
const { color, mode, image, onChange, aspectRatio, isVisible, toggleVisibility } = this.props
|
|
|
|
const { mounted } = this.state
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let background =
|
|
|
|
let background =
|
|
|
|
typeof color === 'string'
|
|
|
|
typeof color === 'string'
|
|
|
@ -68,7 +61,7 @@ class BackgroundSelect extends React.PureComponent {
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className="picker-tabs-contents">
|
|
|
|
<div className="picker-tabs-contents">
|
|
|
|
<div style={mode === 'color' ? {} : { display: 'none' }}>
|
|
|
|
<div style={mode === 'color' ? {} : { display: 'none' }}>
|
|
|
|
{mounted && <ColorPicker color={color} onChange={this.handlePickColor} />}
|
|
|
|
<ColorPicker color={color} onChange={this.handlePickColor} />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div style={mode === 'image' ? {} : { display: 'none' }}>
|
|
|
|
<div style={mode === 'image' ? {} : { display: 'none' }}>
|
|
|
|
<ImagePicker onChange={onChange} imageDataURL={image} aspectRatio={aspectRatio} />
|
|
|
|
<ImagePicker onChange={onChange} imageDataURL={image} aspectRatio={aspectRatio} />
|
|
|
|