Quantcast
Channel: Active questions tagged react-native+android - Stack Overflow
Viewing all articles
Browse latest Browse all 29880

injectedJavaScript is not working in Webview of react native

$
0
0

I am not able to inject this simple js code into react-native webview.

I referred this link also but no solution provided here.

Then I found this one which works for html props but not uri.

import React, { Component } from 'react';import { Platform,  StyleSheet,  Text,  View,  WebView} from 'react-native';export default class App extends Component<{}> {  injectjs(){    let jsCode = 'alert(hello)';    return jsCode;  }  render() {    return <WebView     javaScriptEnabled={true}    injectedJavaScript={this.injectjs()}     source={{uri:"https://www.google.com"}} style={{ marginTop: 20 }} />;  }}

Viewing all articles
Browse latest Browse all 29880

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>