title: How can I get the value of a variable sent in a WebView in the HTML page?
body: <p>I am developing an App that needs to send variables to an html page that will be displayed in a WebView. Here is a basic example of the React Native Application code.</p>
  
  <pre><code>export default class App extends Component {
  
  
    render()
    {
  
     let variableCadena="React Native";
  
  
  
  
      return(
  
        &lt;Container&gt;
          &lt;WebView
          style={{flex: 1}}
          originWhitelist={['*']}
          source={{uri:'file:///android_asset/PaginaEjemplo.html'}}
           style={{ marginTop: 20 }}
          javaScriptEnabled={true}
          domStorageEnabled={true}
          allowFileAccess={true}
          allowUniversalAccessFromFileURLs={true}
          injectedJavaScript={variableCadena} 
          &gt;
  
        &lt;/WebView&gt;      
        &lt;/Container&gt;
      );
    }
  };
  </code></pre>
  
  <p>The HTML can be as simple as the following one.</p>
  
  <pre><code>    &lt;html&gt;
      &lt;head&gt;
      &lt;title&gt;Ejemplo de inyeccion desde React Native&lt;/title&gt;
      &lt;script type="text/javascript"&gt;
          var variable = variableCadena;
      &lt;/script&gt;
      &lt;/head&gt;
  
      &lt;body&gt;
      &lt;script type="text/javascript"&gt;
  
      document.body.innerHTML = "&lt;h1&gt;La variable es:"
      +variable+ "&lt;/h1&gt;"
  
     &lt;/script&gt;
     &lt;/body&gt;
     &lt;/html&gt;
  </code></pre>
  
  <p>The result that is expected is that the web page shows in the h1 tags the React Native text that was defined in the application. Thank you all for your suggestions.</p>