Comments (4)
This is what i did to get Single Image option functionality on the component (so you can use it or not when initialising):
Added prop on: ReactImageUploadComponent.defaultProps
singleImage: false
Added prop type on: ReactImageUploadComponent.PropTypes
singleImage: PropTypes.bool
And then rewrote function render.onload like this:
reader.onload = function () {
return function (e) {
if (_this.props.singleImage === true) {
_this.setState({ pictures: [e.target.result] });
} else if (_this.state.pictures.indexOf(e.target.result) === -1) {
var _newArray2 = _this.state.pictures.slice();
_newArray2.push(e.target.result);
_this.setState({ pictures: _newArray2 });
}
};
}(f);
@JakeHartnell could you please add this as a new feature? Thanks!
from react-images-upload.
Thanks for the code snippet @IvanLinos, I'll add this soon.
from react-images-upload.
Hi @JakeHartnell i finally had the time to properly fork the project and create a pull request for the component and the demo app/documentation , please test it when you have time :)
from react-images-upload.
Thanks @IvanLinos for the PR, version 1.0.5 is published: https://www.npmjs.com/package/react-images-upload
from react-images-upload.
Related Issues (20)
- Default Images Array HOT 2
- NextJs incompatibility: Global CSS cannot be imported from within node_modules. HOT 5
- index.d.ts interface have incorrect props
- How to adjust image&delete button style
- Can you provide a React-Ref directly to file input?
- How to prevent duplicate image selection
- Warning: componentWillReceiveProps has been renamed, and is not recommended for use.
- hi man how to cropping functionality is not working when we pass with inside the image uploadinga
- Future of this package...
- Error on nextjs HOT 3
- on upload, uploading the first image two times
- how we can review the after submit the images.
- I want to remove the defaultImages when submitting a new one
- Default Image does not change HOT 1
- withPreview is false by default but shown true in the docs
- Is there anyway to persist uploaded image ? HOT 1
- Not compatible with React 17.0.2 HOT 1
- unexpected token '.'for index.css HOT 2
- I can't upload ".heic" format images
- Accessibility error: missing form label
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-images-upload.