
语言 🇨🇳 简体中文
🇺🇸
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 
此库在 VanillaJS 库外层使用了一个 webview。
FastComments 现在在 fastcomments-react-native-sdk 中支持我们客户端的完全原生实现。 如果您想要完全的原生实现,建议查看该项目。
用法 - 实时评论组件 
与 fastcomments-react 相比,API 略有不同。在原生环境中,我们传入一个遵循 此结构 的配置对象。
import { FastCommentsCommentWidget } 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, 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 仓库。