@fishjam-cloud/react-native-client

中文文档
0.31.1发布于 2026/10/22Apache-2.0TypeScriptCommonJS构建来源已验证近 30 天下载 1.2万

React Native client library for Fishjam

原始使用文档
文档目录10 节
  1. Installation
  2. Android VoIP setup
  3. Expo
  4. Call timeouts
  5. Bare React Native
  6. Local Development with WebRTC Fork
  7. Setup
  8. Development Workflow
  9. Updating the Submodule
  10. Contributing Changes to the Fork

@fishjam-cloud/react-native-client

React Native client library for Fishjam.

Installation

npm install @fishjam-cloud/react-native-client
# or
yarn add @fishjam-cloud/react-native-client

Android VoIP setup

Incoming calls on Android are delivered over Firebase Cloud Messaging, so Firebase is only pulled into your build when you opt in. iOS uses PushKit/APNs and needs none of this.

Expo

Enable VoIP in the config plugin and point Expo at your google-services.json:

{
  "expo": {
    "android": { "googleServicesFile": "./google-services.json" },
    "plugins": [["@fishjam-cloud/react-native-client", { "android": { "enableVoIP": true } }]]
  }
}

Prebuild does the rest. android.googleServicesFile makes Expo add the com.google.gms:google-services classpath, apply the Gradle plugin, and copy the file into android/app/. Omitting it while enableVoIP is on is a prebuild error.

Call timeouts

The plugin can set native timeouts in seconds. An unanswered incoming call defaults to 45 seconds, an unconnected outgoing call defaults to 60 seconds, and the answer-fulfillment handshake defaults to 10 seconds:

{
  "expo": {
    "plugins": [
      [
        "@fishjam-cloud/react-native-client",
        {
          "android": { "enableVoIP": true },
          "voip": {
            "incomingCallTimeout": 45,
            "outgoingCallTimeout": 60,
            "fulfillAnswerCallTimeout": 10
          }
        }
      ]
    ]
  }
}

All timeout properties are optional and must be positive finite numbers. Omit a property to use its native default.

Bare React Native

Config plugins do not run, and the google-services Gradle plugin must be applied to the application module — a library cannot do it for you. Follow the Firebase Android setup guide to add google-services.json and apply the plugin.

You must also declare by hand what the config plugin would otherwise inject into AndroidManifest.xml — the MANAGE_OWN_CALLS, POST_NOTIFICATIONS, USE_FULL_SCREEN_INTENT and VIBRATE permissions, the IncomingCallActivity, the EndCallNotificationReceiver, and the PushNotificationService with its com.google.firebase.MESSAGING_EVENT intent filter. See plugin/src/withFishjamVoIPAndroid.ts for the exact entries.

Set timeout metadata manually when using bare React Native:

<application>
  <meta-data android:name="VoIPIncomingCallTimeout" android:value="45" />
  <meta-data android:name="VoIPOutgoingCallTimeout" android:value="60" />
  <meta-data android:name="VoIPFulfillAnswerTimeout" android:value="10" />
</application>

For iOS, add the same timeout values as numeric Info.plist keys: VoIPIncomingCallTimeout, VoIPOutgoingCallTimeout, and VoIPFulfillAnswerTimeout.

Local Development with WebRTC Fork

This package depends on @fishjam-cloud/react-native-webrtc, a fork of react-native-webrtc. The fork lives in its own GitHub repo and is included in this monorepo as a git submodule at packages/react-native-webrtc/, wired up as a yarn workspace. No manual linking is required.

Setup

Clone the repository with submodules:

git clone --recurse-submodules https://github.com/fishjam-cloud/web-client-sdk.git

If you already cloned without --recurse-submodules, initialize the submodules from inside the repo:

git submodule update --init --recursive

Then install dependencies from the repo root:

yarn install

Yarn resolves @fishjam-cloud/react-native-webrtc to the workspace at packages/react-native-webrtc/, and React Native autolinking picks up the native iOS and Android code automatically through the symlinked package.

Development Workflow

Change TypeWhat to Do
JS/TS changes in the forkSave → Metro hot reloads automatically
Native code changes (iOS/Android)Save → Rebuild the app (yarn ios or yarn android)

No pod install or yarn install is needed after native code changes — just rebuild the app.

Updating the Submodule

The submodule tracks the fork's master branch but is pinned to a specific commit. To update to the latest upstream:

git submodule update --remote packages/react-native-webrtc
git add packages/react-native-webrtc
git commit -m "Bump react-native-webrtc submodule"

To check out a specific tag or commit:

git -C packages/react-native-webrtc fetch
git -C packages/react-native-webrtc checkout <tag-or-sha>
git add packages/react-native-webrtc
git commit -m "Pin react-native-webrtc to <tag-or-sha>"

When bumping the submodule across a version boundary, also update peerDependencies.@fishjam-cloud/react-native-webrtc in this package's package.json so external consumers see the correct range.

Contributing Changes to the Fork

Changes inside packages/react-native-webrtc/ belong to the fork's own repo, not this one. To push them upstream:

cd packages/react-native-webrtc
git checkout -b your-feature-branch
# commit your changes
git push origin your-feature-branch
# open a PR against fishjam-cloud/fishjam-react-native-webrtc

Once the upstream PR is merged, bump the submodule sha here (see "Updating the Submodule" above).

版本与发布记录

@fishjam-cloud/react-native-client 共发布 61 个版本,首次发布于 2024/09/05;过去 12 个月发布了 30 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.31.1latest2026/10/2223 天前
0.31.02026/09/301 个月前
0.30.22026/09/191 个月前
0.30.2-rc.0rc2026/09/142 个月前
0.30.12026/09/102 个月前
0.30.02026/08/262 个月前

关于 @fishjam-cloud/react-native-client 的常见问题

@fishjam-cloud/react-native-client 是什么?

React Native client library for Fishjam

如何安装 @fishjam-cloud/react-native-client?

在项目目录运行 npm install @fishjam-cloud/react-native-client,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:expo(*)、react(*)、react-native(*)、react-native-get-random-values(1.11.0)、@fishjam-cloud/react-native-webrtc(0.31.1)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@fishjam-cloud/react-native-client 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@fishjam-cloud/react-native-client 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@fishjam-cloud/react-native-client 可以商用吗?

@fishjam-cloud/react-native-client 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@fishjam-cloud/react-native-client 的下载量有多少?

根据 npm 官方下载统计,@fishjam-cloud/react-native-client 在 2026/10/15 – 2026/11/13 这 30 天内被下载 11,501 次,日均约 383 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@fishjam-cloud/react-native-client 还在维护吗?

最新版本 0.31.1 发布于 2026/10/22(23 天前);至今共发布 61 个版本,其中过去 12 个月发布了 30 个;首次发布于 2024/09/05。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。