@deltabreen/help-react-native

中文文档
0.1.1发布于 2026/11/01MITTypeScriptES Module零依赖

Help by DeltaBreen for React Native and Expo: a helpdesk in your app. The support form and a user's own tickets on a screen of your app, with logged-in users, a key per phone, and the form's events handed back.

原始使用文档
文档目录5 节
  1. On your website's page
  2. Logged-in users
  3. Your app has no website
  4. Events
  5. Your own web view

Help by DeltaBreen for React Native

A helpdesk in your app: the support form and a user's own tickets, with your team's replies, on a screen of your React Native or Expo app. It shows Help's own form in a web view, so your app gets our fixes without a release of yours, and hands its events back to your code.

npx expo install @deltabreen/help-react-native react-native-webview   # an Expo app
npm install @deltabreen/help-react-native react-native-webview         # any other, then: cd ios && pod install

On your website's page

Make a page on your website that holds only the form and the user's own tickets, at an address like https://acme.com/app-support (your site's Install tab has it, with your key, when the site is a Mobile app). Then show it:

import { HelpScreen } from '@deltabreen/help-react-native'

export function Support({ token }) {
  return <HelpScreen page="https://acme.com/app-support" token={token} style={{ flex: 1 }} onSent={({ number }) => console.log(number)} />
}

Your website's verified domain is what lets your live key work, as it does on the website itself. Links to your site stay in the app; anything else, like a file in one of your team's replies, opens in the phone's browser.

The form's button for adding a file opens the phone's own picker. On an iPhone it offers Take Photo, and iOS closes an app that opens the camera without saying why. Add NSCameraUsageDescription to your app's Info.plist, with the words iOS should show when it asks; in Expo, in app.json:

{ "expo": { "ios": { "infoPlist": { "NSCameraUsageDescription": "To send a photo to support." } } } }

Logged-in users

A user who is logged in to your app writes in without typing their email, and sees their own tickets and your replies. Your server signs a short token that says who they are, with your site's secret (the guide has the code). Ask your server for one each time the screen opens and pass it as token; it is handed to the page before its scripts run. Without one, the form treats them as a guest.

Your app has no website

Leave page out and give your site's key: the screen carries the page itself. In the portal, choose My app has no website for the site. Your live key then works for people logged in to your app, and, if you switch it on, for anyone with your app, by a key made for the phone the first time support opens:

// npx expo install expo-secure-store expo-crypto
import * as Crypto from 'expo-crypto'
import * as SecureStore from 'expo-secure-store'
import { HelpScreen, useDeviceKey } from '@deltabreen/help-react-native'

export function Support({ token }) {
  const deviceKey = useDeviceKey(SecureStore, Crypto.getRandomBytes)
  return <HelpScreen siteKey="pk_live_…" token={token} deviceKey={token ? undefined : deviceKey} style={{ flex: 1 }} />
}

useDeviceKey makes the key once and keeps it in the store you give it (anything with getItem and setItem works too); it is null until it has been read, and the screen waits for it. A new phone, or the app installed again, starts fresh. We recommend signing your users in through your own server where you can: a key inside an app can be taken out of it, and only logged-in users can't be made up.

With no website, show picks the form, the tickets or both (the default), and lang, accent, labels, subject and fields are the elements' own, as in the embed's guide.

pageCss is your own CSS for that page, after ours: its background and type, and the form through its custom properties and parts. Put a screen of tickets elsewhere with a second screen, show="tickets":

<HelpScreen siteKey="pk_live_…" show="form" pageCss="body { background: #0f1115; color: #e8e8e8 } db-help-form { --dbh-accent: #7c5cff; --dbh-radius: 14px }" />
<HelpScreen siteKey="pk_live_…" show="tickets" pageCss="db-help-tickets::part(ticket-preview) { opacity: .6 }" />

Events

PropWhen
onSentA message was sent: { number }
onErrorIt could not be: { code }
onRepliedThey replied to a ticket: { number }
onClosedThey marked a ticket solved: { number }
onRatedThey rated one: { number, stars }
onUnreadHow many of your team's replies they haven't read: { unread }
onViewThe ticket they opened, or null for the list: { ticket }

To tell people of a reply while the screen is closed, a webhook (Pro and higher) can send your app's own notification.

Your own web view

helpPage({ siteKey, … }) is the page an app with no website shows, and helpScript({ token, deviceKey }) what runs before its scripts: give them to your own web view (injectedJavaScriptBeforeContentLoaded), and its events arrive as postMessage JSON with deltahelp naming each. webViewProps passes anything else to ours.

版本与发布记录

@deltabreen/help-react-native 共发布 3 个版本,首次发布于 2026/11/01;过去 12 个月发布了 3 个版本。

版本发布日期距今
0.1.1latest2026/11/012 天前
0.1.02026/11/012 天前
0.0.0-stage2026/11/012 天前

关于 @deltabreen/help-react-native 的常见问题

@deltabreen/help-react-native 是什么?

DeltaBreen为React Native和Expo提供的帮助:应用程序中的帮助台。应用程序屏幕上的支持表单和用户自己的票,登录用户,每部手机的钥匙,以及表单的事件。

如何安装 @deltabreen/help-react-native?

在项目目录运行 npm install @deltabreen/help-react-native,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(>=18)、react-native(>=0.70)、react-native-webview(>=13)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@deltabreen/help-react-native 支持 TypeScript 吗?

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

@deltabreen/help-react-native 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@deltabreen/help-react-native 可以商用吗?

@deltabreen/help-react-native 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@deltabreen/help-react-native 还在维护吗?

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