Created
March 19, 2018 15:39
-
-
Save nanlabsweb/f2dd1c81606b1df1f42e56b6dd9cca90 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setImageSize(width, height){ | |
if (this.props.width && !this.props.height) { | |
this.setState({ | |
width: this.props.width, | |
height: height * (this.props.width / width) | |
}); | |
} else if (!this.props.width && this.props.height) { | |
this.setState({ | |
width: width * (this.props.height / height), | |
height: this.props.height | |
}); | |
} else { | |
this.setState({ | |
width: width, | |
height: height | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment