2016-11-15 77 views
1

我試圖使用ShareDialog通過React-Native-FBSDK庫共享鏈接。我有我的代碼設置像這樣:React-Native FBSDK Share對話框僅適用於模擬器(iOS)

const shareContent = { 
    contentType: 'link', 
    contentDescription: 'Stuff here', 
    contentTitle: 'Share Title', 
    contentUrl: 'https://google.com', 
    imageUrl: someUrl 
} 

ShareDialog.canShow(shareContent).then((canShow) => { 
    canShow && ShareDialog.show(shareContent); 
} 

此代碼工作在模擬器,當它在Safari瀏覽器的WebView打開,但是當我加載它安裝了Facebook應用程序的設備上,它在打開模型我的應用程序,但它只使用我給它的網址,然後它從網頁上的元標記填充所有其他數據,而不是使用我的代碼。有什麼我需要做的,以使其與原生應用程序一起工作?

enter image description here enter image description here

iOS的10,反應本地0.30.0,反應母語-fbsdk 0.4.0

回答

1

我有同樣的問題。我的解決方案是使用ShareButton而不是ShareDialog。它適用於我的iPhone 10.2。

import {ShareButton} from "react-native-fbsdk"; 


const shareModel = { 
     contentType: 'link', 
     contentUrl: this.url, 
     contentTitle: this.title, 
     contentDescription: this.description, 
     imageUrl: this.thumb 
    }; 

<ShareButton shareContent={shareModel}/> 
+0

this.thumb的值是什麼?它允許外部URL嗎? – Pavan

相關問題