diff --git a/README.md b/README.md index 6f86e79..8243a75 100644 --- a/README.md +++ b/README.md @@ -83,36 +83,41 @@ class App extends React.Component { } ``` +## Styles + +This component requires some styles to be available in the document. By default, you don't need to do anything, the component will automatically inject the required styles in the document head. If you want to disable this behaviour and manually inject the CSS, you can set the `disableAutomaticStylesInjection` prop to `true` and use the file available in the package: `react-easy-crop/react-easy-crop.css`. + ## Props -| Prop | Type | Required | Description | -| :---------- | :---------------------------------- | :------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `image` | string | | The image to be cropped. `image` or `video` is required. | -| `video` | string | | The video to be cropped. `image` or `video` is required. | -| `crop` | `{ x: number, y: number }` | ✓ | Position of the media. `{ x: 0, y: 0 }` will center the media under the cropper. | -| `zoom` | number | | Zoom of the media between `minZoom` and `maxZoom`. Defaults to 1. | -| `rotation` | number (in degrees) | | Rotation of the media. Defaults to 0. | -| `aspect` | number | | Aspect of the cropper. The value is the ratio between its width and its height. The default value is `4/3` | -| `minZoom` | number | | Minimum zoom of the media. Defaults to 1. | -| `maxZoom` | number | | Maximum zoom of the media. Defaults to 3. | -| `zoomWithScroll` | boolean | | Enable zoom by scrolling. Defaults to `true` | -| `cropShape` | 'rect' \| 'round' | | Shape of the crop area. Defaults to 'rect'. | -| `cropSize` | `{ width: number, height: number }` | | Size of the crop area (in pixels). If you don't provide it, it will be computed automatically using the `aspect` prop and the media size. _Warning_: This property is rerendering the component when changed so you need to ensure that you are not providing a new object instance at each render. | -| `showGrid` | boolean | | Whether to show or not the grid (third-lines). Defaults to `true`. | -| `zoomSpeed` | number | | Multiplies the value by which the zoom changes. Defaults to 1. | -| `onCropChange` | crop => void | ✓ | Called everytime the crop is changed. Use it to update your `crop` state. | -| `onZoomChange` | zoom => void | | Called everytime the zoom is changed. Use it to update your `zoom` state. | -| `onRotationChange` | rotation => void | | Called everytime the rotation is changed (with mobile gestures). Use it to update your `rotation` state. | -| [`onCropComplete`](#onCropCompleteProp) | Function | | Called when the user stops moving the media or stops zooming. It will be passed the corresponding cropped area on the media in percentages and pixels | -| `style` | `{ containerStyle: object, mediaStyle: object, cropAreaStyle: object }` | | Custom styles to be used with the Cropper. Styles passed via the style prop are merged with the defaults. | -| `classes` | `{ containerClassName: string, mediaClassName: string, cropAreaClassName: string }` | | Custom class names to be used with the Cropper. Classes passed via the classes prop are merged with the defaults. | -| `mediaProps` | object | | The properties you want to apply to the media tag ( or