I'm looking for a way to auto focus an input / textarea field OR trigger a tap inside of a WebView component in React Native. The goal behind autofocus is to make sure the keyboard pops-up right away...
Does anyone have any ideas? Tips to open or close the keyboard are also useful...
I also filed an issue here: https://github.com/facebook/react-native/issues/18965
1 Answers
Answers 1
See https://facebook.github.io/react-native/docs/webview.html#injectedjavascript
You can execute any javascript on WebView page
let injectScript = `document.querySelector('#myInput').focus();`; <WebView injectedJavaScript={injectScript} source={{uri:"XXX"}} startInLoadingState />
0 comments:
Post a Comment