Browse Source
LL-659 fix autofocus on add account modal
gre-patch-1
Valentin D. Pinkman
6 years ago
No known key found for this signature in database
GPG Key ID: E7D110669FFB8D3E
1 changed files with
17 additions and
0 deletions
-
src/components/base/Select/index.js
|
|
@ -37,6 +37,19 @@ export type Option = { |
|
|
|
} |
|
|
|
|
|
|
|
class Select extends PureComponent<Props> { |
|
|
|
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<Props> { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
ref: * |
|
|
|
timeout: * |
|
|
|
|
|
|
|
render() { |
|
|
|
const { |
|
|
|
value, |
|
|
@ -68,6 +84,7 @@ class Select extends PureComponent<Props> { |
|
|
|
|
|
|
|
return ( |
|
|
|
<ReactSelect |
|
|
|
ref={c => (this.ref = c)} |
|
|
|
value={value} |
|
|
|
maxMenuHeight={300} |
|
|
|
classNamePrefix="select" |
|
|
|