Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use props.file in FileUpload #180

Open
stefansvard opened this issue Sep 14, 2016 · 1 comment
Open

Use props.file in FileUpload #180

stefansvard opened this issue Sep 14, 2016 · 1 comment

Comments

@stefansvard
Copy link

Hi!

As far as I can see (in FileUpload.js)
propTypes: {
buttonLabelChange: React.PropTypes.string,
buttonLabelInitial: React.PropTypes.string,
disabled: React.PropTypes.bool,
file: React.PropTypes.object,
onChange: React.PropTypes.func
}
file can be sent in as props.

but in render there is no connection to this props but only to the file set in the components state.

So e.g. if user uses the FileDragAndDrop there is no way to inject the dropped file into the FileUpload component.

By changing in the render function to prioritize the props.file value, if set, this works nicely
var file = this.props.file || _state.file;

Don't know if this breaks anything else but I post it here if it here and hopefully it helps this great project and perhaps could be included in a future release

BR
Stefan

@jossmac
Copy link
Member

jossmac commented Sep 9, 2017

Sounds good!

Any chance we can get a PR on this @stefansvard?

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

No branches or pull requests

2 participants