Reactjs 如何自动对焦文本区域?

Reactjs 如何自动对焦文本区域?,reactjs,textarea,Reactjs,Textarea,我已经尝试过自动对焦或对焦(),但似乎不起作用 <textarea autoFocus /> or <textarea ref="textarea" /> componentDidMount() { findDOMNode(this.refs.textarea).focus(); } 或 componentDidMount(){ findDOMNode(this.refs.textarea).focus(); } 编辑 autoFocus在chrome中似乎

我已经尝试过自动对焦或对焦(),但似乎不起作用

<textarea autoFocus />

or

<textarea ref="textarea" />
componentDidMount() {
  findDOMNode(this.refs.textarea).focus();
}

或
componentDidMount(){
findDOMNode(this.refs.textarea).focus();
}
编辑
autoFocus
在chrome中似乎可以工作

两个
autoFocus
foucs()
在iOS中都不起作用

componentDidMount
中调用
focus()
似乎在桌面Chrome和Firefox中都能正常工作

似乎有很多元素。

使sur不使用