From 2e95a46316741abdcefc47da47862f8e0777ed90 Mon Sep 17 00:00:00 2001 From: zhenghe Date: Mon, 18 Jul 2016 15:25:28 +0800 Subject: [PATCH] fix bugs in text input --- README.md | 3 +++ src/MDSearchBox.jsx | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index aaba57b..9bc7eb8 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/src/MDSearchBox.jsx b/src/MDSearchBox.jsx index 06ab8d4..a62019c 100644 --- a/src/MDSearchBox.jsx +++ b/src/MDSearchBox.jsx @@ -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 (
@@ -30,7 +31,7 @@ class MDSearchBox extends Component { placeholder="搜索" onChange={this.onChange} className={styles.input} - value={!!this.props.text || null} + {...inputOptionalProps} />