diff --git a/src/components/base/Select/index.js b/src/components/base/Select/index.js index 3551b4dc..7ae2daaf 100644 --- a/src/components/base/Select/index.js +++ b/src/components/base/Select/index.js @@ -37,6 +37,19 @@ export type Option = { } class Select extends PureComponent { + componentDidMount() { + if (this.ref) { + // $FlowFixMe + this.timeout = setTimeout(() => this.ref.focus(), 16) + } + } + + componentWillUnmount() { + if (this.timeout) { + clearTimeout(this.timeout) + } + } + handleChange = (value, { action }) => { const { onChange } = this.props if (action === 'select-option') { @@ -47,6 +60,9 @@ class Select extends PureComponent { } } + ref: * + timeout: * + render() { const { value, @@ -68,6 +84,7 @@ class Select extends PureComponent { return ( (this.ref = c)} value={value} maxMenuHeight={300} classNamePrefix="select"