
語言 🇹🇼 繁體中文
🇺🇸
English
🇧🇬
Български
🇨🇳
简体中文
🇹🇼
繁體中文
🇭🇷
Hrvatski
🇩🇰
Dansk
🇳🇱
Nederlands
🇺🇸
English (US)
🇨🇦
Français (Canada)
🇫🇷
Français (France)
🇩🇪
Deutsch
🇨🇾
Ελληνικά (Κύπρος)
🇬🇷
Ελληνικά
🇮🇱
עברית
🇮🇹
Italiano
🇯🇵
日本語
🇰🇷
한국어
🇵🇱
Polski
🇧🇷
Português (Brasil)
🇷🇺
Русский
🇺🇦
Русский (Украина)
🇧🇦
Српски (БиХ)
🇷🇸
Srpski (Latinica)
🇲🇪
Српски (Црна Гора)
🇷🇸
Српски
🇸🇮
Slovenščina
🇪🇸
Español
🇺🇦
Українська
🇹🇷
Türkçe
快速開始
文件
使用
FastComments React Native Library
這是 FastComments 的官方 React Native 函式庫。
供 React Native 使用的 FastComments 評論元件
儲存庫
安裝 
npm install react-native-webview@13.6.4 --save
npm install fastcomments-react-native --save
注意:截至 2024 年 7 月,react-native-webview 似乎有一個錯誤,最好鎖定到 13.6.4 — 不要使用 ^ 來取得最新的修補程式版本。
考慮使用原生 SDK 
此函式庫使用一個 webview 來包裹 VanillaJS 函式庫。
FastComments 現在支援作為 fastcomments-react-native-sdk 一部分的完全原生實作。 如果您想要完全原生的實作,您可以考慮查看那裡。
使用 - 即時留言元件 
與 fastcomments-react 相比,這個 API 有些不同。在原生(native)中,我們傳入一個遵循 此結構 的 config 物件。
import { FastCommentsCommentWidget } from 'fastcomments-react-native';
// ...
const myTenantId = 'demo'; // 您的 tenant id。可以從 https://fastcomments.com/auth/my-account/api-secret 取得
const myAppPageId = 'native-test'; // 您應用程式中討論串的 ID 或 URL。
const myAppPageUrl = 'https://example.com/external-page'; // 您可以選擇設定一個外部頁面的 URL
const myAppPageTitle = 'Example Title'; // ... 並且您可能想為此內容設定一個標題
const [config, setConfig] = useState({
tenantId: myTenantId,
urlId: myAppPageId,
url: myAppPageUrl,
pageTitle: myAppPageTitle
});
// 透過呼叫 setConfig(),我們可以做像是更換當前頁面或目前登入的使用者之類的操作
// 參見 example/src/App.tsx
return (
<FastCommentsCommentWidget config={config}/>
);
使用 - 即時聊天元件 
import { FastCommentsLiveChatWidget } from 'fastcomments-react-native';
// ...
const myTenantId = 'demo'; // 您的租戶 ID。可以從 https://fastcomments.com/auth/my-account/api-secret 取得
const myAppPageId = 'native-test'; // 您應用中留言串的 ID 或 URL。
const myAppPageUrl = 'https://example.com/external-page'; // 您可以選擇為外部頁面設定 url
const myAppPageTitle = 'Example Title'; // …並且您可能會想為此內容設定標題
const config = {
tenantId: myTenantId,
urlId: myAppPageId,
url: myAppPageUrl,
pageTitle: myAppPageTitle
};
return (
<FastCommentsLiveChatWidget config={config}/>
);
使用 - 單一登入 (SSO) 
FastComments 使用 HMAC 來進行安全的 SSO。要使用,請讓您的後端建立 SSO 物件(sso 設定屬性)並將其傳遞給
評論元件。
您可以在這裡找到針對各種後端的範例: https://github.com/FastComments/fastcomments-code-examples/tree/master/sso
需要幫助?
如果您在使用 React Native 函式庫時遇到任何問題或有任何疑問,請:
貢獻
歡迎貢獻!請造訪 GitHub 儲存庫 以取得貢獻指南。