Closed jingxinxin closed 7 years ago
@jingxinxin Can you give me the full content of this file for debug, thx!
I have a same problem. The childs of <Button></Button>
replaced by hidden element
<input type="file" name="ajax-upload-file-input" accept="image/*" multiple="" style="display: none;">
It needs to create special class for right rendering child and catch onClick event. My example: import React from "react"; import {Button} from "react-bootstrap";
class UploadButton extends React.Component {
constructor(props) {
super(props);
}
onclick(e){
this.props.onClick(e);
}
render(){
return <Button onClick={this.onclick.bind(this)}>Upload files
**{this.props.children}**</Button>;
}
}
UploadButton.propTypes = {
children: React.PropTypes.array.isRequired,
onClick: React.PropTypes.func.isRequired
};
export default UploadButton;
You can read childs of chooseFileButton element and add element to his childrens.
@jingxinxin I met the same issue
You need to return <button>
and not <Button>
from this component.
@v-zaburdaev You are right, i will improve this.