我想在react-native webview中设置textarea autoFoucs,但它不起作用?有人知道如何解决它吗?请联系我,谢谢!
<WebView
ref={ref => this.webView = ref}
automaticallyAdjustContentInsets={false}
style={{ width: this.mScreenWidth, flex: 1, backgroundColor: '#fff', marginTop: this._getSize(5), paddingHorizontal: this._getSize(16), paddingTop: this._getSize(5) }}
source={{ uri: 'http://localhost:8081/richEditor/richEditor.html' }}
javaScriptEnabled={true}
dataDetectorTypes='none'
startInLoadingState={true}
scrollEnabled={true} />
<textarea id="textarea" autofocus="autofocus"></textarea> <script type="text/javascript" charset="utf-8"> document.getElementById("textarea").focus(); </script>
答案 0 :(得分:0)
将autoFocus与input元素一起使用
<input autoFocus />