import React from 'react'; import classNames from 'classnames'; import Input, { InputProps } from './Input'; import Icon from '../icon'; export interface SearchProps extends InputProps { inputPrefixCls?: string; onSearch?: (value: string) => any; } export default class Search extends React.Component { static defaultProps = { inputPrefixCls: 'ant-input', prefixCls: 'ant-input-search', }; input: any; onSearch = () => { const { onSearch } = this.props; if (onSearch) { onSearch(this.input.refs.input.value); } this.input.focus(); } render() { const { className, inputPrefixCls, prefixCls, ...others } = this.props; delete (others as any).onSearch; const searchSuffix = ( ); return ( this.input = node} /> ); } }