Skip to content

Commit

Permalink
fix(typescript): change how we import React
Browse files Browse the repository at this point in the history
  • Loading branch information
ValentinH committed Mar 25, 2024
1 parent e53635e commit a0fcb8e
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/Cropper.tsx
@@ -1,4 +1,4 @@
import React from 'react'
import * as React from 'react'
import normalizeWheel from 'normalize-wheel'
import { Area, MediaSize, Point, Size, VideoSrc } from './types'
import {
Expand Down Expand Up @@ -122,7 +122,7 @@ class Cropper extends React.Component<CropperProps, State> {
state: State = {
cropSize: null,
hasWheelJustStarted: false,
mediaObjectFit: undefined
mediaObjectFit: undefined,
}

componentDidMount() {
Expand All @@ -145,7 +145,7 @@ class Cropper extends React.Component<CropperProps, State> {
this.containerRef.addEventListener('gesturestart', this.onGestureStart as EventListener)
}

this.currentDoc.addEventListener('scroll', this.onScroll);
this.currentDoc.addEventListener('scroll', this.onScroll)

if (!this.props.disableAutomaticStylesInjection) {
this.styleRef = this.currentDoc.createElement('style')
Expand All @@ -170,7 +170,6 @@ class Cropper extends React.Component<CropperProps, State> {
if (this.props.setVideoRef) {
this.props.setVideoRef(this.videoRef)
}

}

componentWillUnmount() {
Expand Down Expand Up @@ -221,9 +220,9 @@ class Cropper extends React.Component<CropperProps, State> {
this.videoRef.current?.load()
}

const objectFit = this.getObjectFit();
const objectFit = this.getObjectFit()
if (objectFit !== this.state.mediaObjectFit) {
this.setState({mediaObjectFit: objectFit}, this.computeSizes)
this.setState({ mediaObjectFit: objectFit }, this.computeSizes)
}
}

Expand Down Expand Up @@ -253,7 +252,7 @@ class Cropper extends React.Component<CropperProps, State> {
this.currentDoc.removeEventListener('touchend', this.onDragStopped)
this.currentDoc.removeEventListener('gesturemove', this.onGestureMove as EventListener)
this.currentDoc.removeEventListener('gestureend', this.onGestureEnd as EventListener)
this.currentDoc.removeEventListener('scroll', this.onScroll);
this.currentDoc.removeEventListener('scroll', this.onScroll)
}

clearScrollEvent = () => {
Expand Down Expand Up @@ -472,7 +471,7 @@ class Cropper extends React.Component<CropperProps, State> {

this.currentDoc.addEventListener('touchmove', this.onTouchMove, { passive: false }) // iOS 11 now defaults to passive: true
this.currentDoc.addEventListener('touchend', this.onDragStopped)

this.saveContainerPosition()

if (e.touches.length === 2) {
Expand Down Expand Up @@ -743,7 +742,7 @@ class Cropper extends React.Component<CropperProps, State> {
classes: { containerClassName, cropAreaClassName, mediaClassName },
} = this.props

const objectFit = this.state.mediaObjectFit;
const objectFit = this.state.mediaObjectFit

return (
<div
Expand Down

0 comments on commit a0fcb8e

Please sign in to comment.