I already try autoFocus or focus(), but seems not work.
<textarea autoFocus />
or
<textarea ref="textarea" />
componentDidMount() {
findDOMNode(this.refs.textarea).focus();
}
autoFocus seems work in chrome.
Both autoFocus foucs() not work in iOS.
Calling focus() in componentDidMount seems to work in desktop Chrome and Firefox.
Demo.
It seems that Mobile Safari intentionally suppresses auto-focussing of elements.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With