Giter VIP home page Giter VIP logo

react-drop-n-crop's Issues

Repo settings updates

I don't have permissions, need @bobeagan.

  • Add description An opinionated implementation of react-dropzone and react-cropper
  • Add Tags react javascript drop-n-crop react-drop-n-crop dropzone react-dropzone cropper react-cropper drag-and-drop crop-image image-cropper crop image

Rename onSave prop to onChange

Because this component is intended to be used as a form input it should conform to the established form input api.

In the future, we can look at supporting things like onBlur, etc, but for now just changing onSave to onChange will help.

value or initialValue prop

It'd be nice to figure out how to implement a value prop so that this can be turned into a controlled component. Obviously that would require more information than just the cropped File object that is output by onSave, so this might not be a good idea.

In order to implement a value prop onChange needs to be updated to return an object shaped something like this:

{
  originalImage: File object,
  croppedImage: File object,
  croppedDimensions: {x: int, y: int, width: int, height: int}
}

These values could be useful in other scenarios anyway (especially if we decide to do image processing on the server), but changes fundamentally the simplicity of this component.

At the very least we'll want to do an initialValue prop that takes a File object for use cases like re-cropping an image that's already been uploaded.

Cropper does not crop on initialization

If you set the autoCropArea to any value < 1,, drop an image, and then immediately crop the image without moving the crop area, the value will be the entire image, instead of the cropped area.

Is there a way to set up the cropper so that even when I just dropped an image, the crop result will match the crop area ?

Having issues when using with typescript.

Having issues when using with Typescript.

Could not find a declaration file for module '@synapsestudios/react-drop-n-crop'. '.../node_modules/@synapsestudios/react-drop-n-crop/lib/index.js' implicitly has an 'any' type.
Try npm install @types/synapsestudios__react-drop-n-crop if it exists or add a new declaration (.d.ts) file containing declare module '@synapsestudios/react-drop-n-crop';

using the const = require form cuses problems when I render - with the message that render expects a string but got an object.

[Documentation Suggestion] Converting dataURL to File object

I came across this amazing library yet I have a feeling that documentation is not enough.

In case anyone struggle with handling the uploaded files, hope this help :)

If you follow the instructions at ReadMe.md, then you should have a state variable with 5 attributes (result, filename, filetype, src, err).
The "result" attribute contains a dataURL. Although it is nice of this library to do the conversion for us, sometimes we may need to use a File object. In my case, I need to upload the image to my Firebase Cloud Storage, and the SDK requires a File object.

https://stackoverflow.com/questions/6850276/how-to-convert-dataurl-to-file-object-in-javascript

The above page at stack overflow illustrates exactly what needs to be done.
Good luck with programming!

Required prop warning when used React.cloneElement

When used with redux-form, props are passed in with cloneElement and react throws a warning:
Failed prop type: The prop 'onChange' is marked as required in 'DropNCrop', but its value is 'undefined'.

This is apparently intentional.

facebook/react#4494

Conclusion: Props shouldn't be required. onChange shouldn't be required and should default to a no-op.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.