index.js 810 Bytes
import Taro, {Component} from '@tarojs/taro';
import {View} from '@tarojs/components';
import searchIcon from '../../static/images/gray_search@3x.png';

import './index.scss';

export default class SearchBar extends Component {
    constructor(props) {
        super(props);

        this.state = {};
    }

    static defaultProps = {
        classname: '',
        disabled: false
    }

    render() {
      let { classname, value, disabled} = this.props;

        return (
          <View className={classname + ' search'}>
                <Image src={searchIcon} className="search-icon"/>
        <Input type='text' placeholder = 'Search' value = { value? value : ''} onInput = { this.props.onInputAction } onConfirm = { this.props.onComplate } disabled={disabled} />
            </View>
        )
    }
}