2017-08-17 7 views
0

でネイティブにMathquillを反応させる統合私はは、WebViewのではWebViewの

<!DOCTYPE html> 
<html> 
<header> 
    <link rel="stylesheet" href="./mathquill.css" /> 
    <script src="./jquery.min.js"></script> 
    <script src="./mathquill.js"></script> 
    <script> 
     var MQ = MathQuill.getInterface(2); 
    </script> 
</header> 
<body> 
     <span id="problem">ax^2 + bx + c = 0</span> 
     <script> 
      var problemSpan = document.getElementById('problem'); 
      MQ.StaticMath(problemSpan); 
     </script> 
</body> 
</html> 

は、私が表示されるようにテキストを変更するのWebViewと通信する方法を知ってほしいのindex.htmlファイルでindex.htmlを

<WebView  
    source={{ uri: 'file:///android_asset/index.html' }}  
    startInLoadingState={true}  
    style={{ marginTop: 20, height: 100 }} /> 

追加しました。

答えて

0

検出された溶液。

<WebView 
    ref={(webview) => this.webview = webview } 
    source={{ uri: 'file:///android_asset/index.html' }} 
    startInLoadingState={true} 
    style={{ marginTop: 20, height: 100 }} 
    /> 

document.addEventListener("message", function(data) { 
    ... 
    } 

変更のWebViewをindex.htmlをすると(私はcomponentDidMountでテスト)

componentDidMount() { 
    this.webview.postMessage('message') 
    } 
でデータをポストするためにこれを追加
関連する問題