diff --git a/lib/index.js b/lib/index.js index 048fcf3..4196f81 100644 --- a/lib/index.js +++ b/lib/index.js @@ -8,6 +8,7 @@ var FileInput = React.createClass({ parent: { position: 'relative' }, + // "invisible" above the text file: { position: 'absolute', top: 0, @@ -32,6 +33,7 @@ var FileInput = React.createClass({ }, render: function() { + return React.DOM.div({ style: this.state.styles.parent }, @@ -47,8 +49,8 @@ var FileInput = React.createClass({ style: this.state.styles.file }), - // Emulated file input - React.DOM.input({ + // Emulated file input for when there are no children + this.props.children || React.DOM.input({ type: 'text', tabIndex: -1, name: this.props.name + '_filename', @@ -58,7 +60,8 @@ var FileInput = React.createClass({ placeholder: this.props.placeholder, disabled: this.props.disabled, style: this.state.styles.text - })); + }) + ); } });