Skip to content
This repository was archived by the owner on Jun 5, 2022. It is now read-only.

defaultImage problem #58

Open
f10l opened this issue Jul 16, 2018 · 3 comments
Open

defaultImage problem #58

f10l opened this issue Jul 16, 2018 · 3 comments

Comments

@f10l
Copy link

f10l commented Jul 16, 2018

Hi,

I tried to use a default image as obviously implemented in the code, but not working for me, since componentWillReceiveProps() is not fired.

I get the behavior I expected, if the initalization of the pictures state is already done in the constructor. However, I don't know if this would lead to undesired behavior.

By modifying this line:

to:
pictures: this.props.defaultImage ? [this.props.defaultImage] : [],

the defaultImage works for me. Is this a reasonable change and could maybe modified for the component?

Edit: Of course I also had to uncomment the componentWillReceiveProps() function.

@luckygulli
Copy link

I suggest this pull request.
An idea for future version is to add a defaultImages property, containing an array of urls.

@f10l
Copy link
Author

f10l commented Aug 13, 2018

Thank you for creating the PR!

@JakeHartnell
Copy link
Owner

PR merged: https://www.npmjs.com/package/react-images-upload

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants