Skip to content

Commit

Permalink
fix bugs in text input
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenghe committed Jul 18, 2016
1 parent 31f3616 commit 2e95a46
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@
* **onChange**: (text) => () - the function fired every time the input text changes.
* **width**: number - width of the search box
* **height**: number - height of the search box

## Note
This Component uses FontAwesome icon. So make sure your project has that included.
3 changes: 2 additions & 1 deletion src/MDSearchBox.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class MDSearchBox extends Component {

render() {
const { width, height } = this.props;
const inputOptionalProps = !!this.props.text ? { value: this.props.text } : {};
const style = { width, height };
return (
<div className={styles.container} style={style}>
Expand All @@ -30,7 +31,7 @@ class MDSearchBox extends Component {
placeholder="搜索"
onChange={this.onChange}
className={styles.input}
value={!!this.props.text || null}
{...inputOptionalProps}
/>
</div>
</div>
Expand Down

0 comments on commit 2e95a46

Please sign in to comment.