Update repo to support React 16 #19#23
Open
mkozhukharenko wants to merge 4 commits intoinstructure-react:masterfrom
Open
Update repo to support React 16 #19#23mkozhukharenko wants to merge 4 commits intoinstructure-react:masterfrom
mkozhukharenko wants to merge 4 commits intoinstructure-react:masterfrom
Conversation
isnifer
reviewed
Dec 18, 2017
| let Wrapper = React.createClass({ | ||
| displayName: 'Wrapper', | ||
| class Wrapper extends React.Component { | ||
| displayName = 'Wrapper' |
isnifer
reviewed
Dec 18, 2017
| previewUrl: null | ||
| } | ||
| }, | ||
| } |
There was a problem hiding this comment.
state = {
image: null,
previewUrl: null
}
isnifer
reviewed
Dec 18, 2017
| } | ||
|
|
||
| controlsResize (event) { | ||
| controlsResize = (event) => { |
There was a problem hiding this comment.
controlsResize = ({ target: { name, value } }) => {
isnifer
reviewed
Dec 18, 2017
| controlsResize (event) { | ||
| controlsResize = (event) => { | ||
| let box = this.refs.box.parentElement.parentElement.getBoundingClientRect() | ||
| let width = event.target.name === 'width' ? +event.target.value : +event.target.value * this.props.aspectRatio |
There was a problem hiding this comment.
const rawWidth = name === 'width' ? +value : +value * this.props.aspectRatio
isnifer
reviewed
Dec 18, 2017
| controlsResize = (event) => { | ||
| let box = this.refs.box.parentElement.parentElement.getBoundingClientRect() | ||
| let width = event.target.name === 'width' ? +event.target.value : +event.target.value * this.props.aspectRatio | ||
| let height = event.target.name === 'height' ? +event.target.value : +event.target.value / this.props.aspectRatio |
There was a problem hiding this comment.
const rawHeight = name === 'height' ? +value : +value / this.props.aspectRatio
const [width, height] = this.preserveAspectRatio(rawWidth, rawHeight)
isnifer
reviewed
Dec 18, 2017
| let movedY = evt.target.name === 'y' ? evt.target.value - this.state.top : 0 | ||
| this.moveBox(0, 0, movedX, movedY) | ||
| }, | ||
| } |
There was a problem hiding this comment.
controlsMoveBox = ({ target: { name, value } }) => {
const movedX = name === 'x' ? value - this.state.left : 0
const movedY = name === 'y' ? value - this.state.top : 0
this.moveBox(0, 0, movedX, movedY)
}
isnifer
reviewed
Dec 18, 2017
| export default React.createClass({ | ||
| displayName: 'Cropper', | ||
| export default class extends React.Component { | ||
| displayName = 'Cropper' |
isnifer
reviewed
Dec 18, 2017
| onImageLoaded: React.PropTypes.func, | ||
| minConstraints: React.PropTypes.arrayOf(React.PropTypes.number) | ||
| }, | ||
| propTypes = { |
isnifer
reviewed
Dec 18, 2017
| offsetYLabel: 'Offset Y' | ||
| } | ||
| }, | ||
| defaultProps = { |
isnifer
reviewed
Dec 18, 2017
| url: window.URL.createObjectURL(this.props.image) | ||
| } | ||
| }, | ||
| } |
There was a problem hiding this comment.
state = {
imageLoaded: false,
width: this.props.width,
height: this.props.height,
url: window.URL.createObjectURL(this.props.image)
}
isnifer
reviewed
Dec 18, 2017
|
|
||
| cropImage () { | ||
| cropImage = () => { | ||
| return new Promise((resolve, reject) => { |
|
@mkozhukharenko your turn |
Closed
|
@mkozhukharenko any desire to push this through or can this be closed? |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.