component/Cropper.js
// adjust image height when image size scaleing change, also initialize styles
adjust image height when image size scaleing change, also initialize styles
adjust image height when image size scaleing change also initialize styles
imgGetSizeBeforeLoad () {
    setTimeout(() => {
      const img = findDOMNode(this.img)
      if (img && img.naturalWidth) {
        const imgHeight = parseInt(img.offsetWidth / img.naturalWidth * img.naturalHeight)
        this.setState({
          imgHeight,
          imgLoaded: true
        }, this.initStyles)
        this.props.beforeImgLoad()
      } else if (img) {
        this.imgGetSizeBeforeLoad()
      }
    }, 0)
  }
imgGetSizeBeforeLoad ( ) { setTimeout ( ( ) => { const img = findDOMNode ( this . img ) if ( img && img . naturalWidth ) { const imgHeight = parseInt ( img . offsetWidth / img . naturalWidth * img . naturalHeight ) this . setState ( { imgHeight , imgLoaded : true } , this . initStyles ) this . props . beforeImgLoad ( ) } else if ( img ) { this . imgGetSizeBeforeLoad ( ) } } , 0 ) }
adjust image height when image size scaleing change, also initialize styles
adjust image height when image size scaleing change also initialize styles
// trick way to get natural width of image after component did mount // image scaleing // resize imgHeight // before image loaded hook // catch if image natural width is 0