I am having trouble getting Webview on ReactNative to execute the entered JavaScript on a physical Android device. I combed the network as far as I could in the last 2 days and still have not found a solution. The test results are as follows:
- iOS simulator - All is well
- iPhone is good
- Android simulator - all is well
- Physical devices, Sony Xperia Z2, Sony Xperia Z5 Compact and LG G4 - NOTHING
My Webview is defined as follows:
<WebView style={styles.webView} source={{ html: html, baseUrl: 'web/' }} injectedJavaScript={'render(' + JSON.stringify(this.state.data) + ');'} javaScriptEnabledAndroid={true} scrollEnabled={false} bounces={false} renderLoading={() => <LoadingIndicator />} />
I tried to specify javaScriptEnabled , but to no avail. I also tried fewer scripts just to color the elements on the page or send a message back to the application using window.postMessage , but nothing happens. I need to enter data in HTML, which will display graphs for me based on the data provided. My last resort is to manually create the HTML code with the data added as part of the markup provided by Webview, but I really want it to be simple and simple to work out as it should .
I use the latest version of ReactNative (0.41), and Android 6+ works on phones.
source share