/**
 * Created by zhouhuan on 2017/11/3.
 */
import React, { PureComponent } from 'react';
import { SearchBar } from 'antd-mobile';

class SearchComponent extends PureComponent {
  state = {
    value: '',
  };
  onSubmit = () => {
    this.props.onSearchSubmit(this.state.value);
  };
  onChange= (value) => {
    this.setState({ value });
    this.props.onSearchChange(value);
  };
  render() {
    return (
      <SearchBar
        {...this.props}
        value={this.state.value}
        placeholder="搜索"
        onSubmit={this.onSubmit}
        onChange={this.onChange}
      />
    );
  }
}
export default SearchComponent;
