2017-08-08 16 views

回答

0

您可以使用WebView加載您的網站。

<WebView 
    source={{ uri: 'https://....'}} 
    onMessage={(e) => { console.log(e.nativeEvent.data }} 
/> 

對你的網站,你需要通過

window.postMessage(a_Variable_name)

發送變量當試圖整合這一點,我不得不添加在this Github thread

function waitForBridge() { 
    if (window.postMessage.length !== 1) { 
    setTimeout(waitForBridge, 200); 
    } else { 
    window.postMessage(a_Variable_name); 
    } 
} 
window.onload = waitForBridge 
+0

問題指定的功能是網站不是我的。 – TheGreatA

+0

我想我可以使用JQuery來取消它? – TheGreatA