Skip to content

Update repo to support React 16 #19 - #23

Open
mkozhukharenko wants to merge 4 commits into
instructure-react:masterfrom
mkozhukharenko:master
Open

Update repo to support React 16 #19#23
mkozhukharenko wants to merge 4 commits into
instructure-react:masterfrom
mkozhukharenko:master

Conversation

@mkozhukharenko

Copy link
Copy Markdown

No description provided.

@mkozhukharenkomkozhukharenko changed the title Update repo to support React 16Update repo to support React 16 #19Nov 1, 2017
Comment threaddocs/index.js
let Wrapper = React.createClass({
displayName: 'Wrapper',
class Wrapper extends React.Component {
displayName = 'Wrapper'

@isniferisniferDec 18, 2017

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

staticdisplayName='Wrapper'

Comment threaddocs/index.js
previewUrl: null
}
},
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

state={image: null,previewUrl: null}

}

controlsResize (event) {
controlsResize = (event) => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

controlsResize=({target: { name, value }})=>{

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

@isniferisniferDec 18, 2017

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

constrawWidth=name==='width' ? +value : +value*this.props.aspectRatio

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

@isniferisniferDec 18, 2017

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

constrawHeight=name==='height' ? +value : +value/this.props.aspectRatioconst[width,height]=this.preserveAspectRatio(rawWidth,rawHeight)

let movedY = evt.target.name === 'y' ? evt.target.value - this.state.top : 0
this.moveBox(0, 0, movedX, movedY)
},
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

controlsMoveBox=({target: { name, value }})=>{constmovedX=name==='x' ? value-this.state.left : 0constmovedY=name==='y' ? value-this.state.top : 0this.moveBox(0,0,movedX,movedY)}

Comment threadlib/index.src.js
export default React.createClass({
displayName: 'Cropper',
export default class extends React.Component {
displayName = 'Cropper'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

staticdisplayName='Cropper'

Comment threadlib/index.src.js
onImageLoaded: React.PropTypes.func,
minConstraints: React.PropTypes.arrayOf(React.PropTypes.number)
},
propTypes = {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

staticpropTypes={

Comment threadlib/index.src.js
offsetYLabel: 'Offset Y'
}
},
defaultProps = {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

staticdefaultProps={

Comment threadlib/index.src.js
url: window.URL.createObjectURL(this.props.image)
}
},
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

state={imageLoaded: false,width: this.props.width,height: this.props.height,url: window.URL.createObjectURL(this.props.image)}

Comment threadlib/index.src.js

cropImage () {
cropImage = () => {
return new Promise((resolve, reject) => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

returnnewPromise((resolve)=>{

@isnifer

Copy link
Copy Markdown

@mkozhukharenko your turn

@shichongruishichongrui mentioned this pull request May 24, 2018
@shichongrui

Copy link
Copy Markdown

@mkozhukharenko any desire to push this through or can this be closed?

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@mkozhukharenko@isnifer@shichongrui