Skip to content

feat(rn-webview): @chativa/rn-webview package - #32

Merged
AimTune merged 5 commits into
mainfrom
feature/chativa-rn-webview
Jul 27, 2026
Merged

feat(rn-webview): @chativa/rn-webview package#32
AimTune merged 5 commits into
mainfrom
feature/chativa-rn-webview

Conversation

@AimTune

@AimTune AimTune commented Jul 27, 2026

Copy link
Copy Markdown
Owner

Summary

  • New @chativa/rn-webview package: <ChativaWebView> embeds the existing web chat widget (@chativa/ui + @chativa/genui, loaded from each package's published CDN/global build) inside a react-native-webview, bridged to native props/callbacks via window.chativaSettings + EventBuspostMessage.
  • Because the widget's JS genuinely runs inside the WebView's own browser engine (not RN's JS runtime), every existing @chativa/connector-* package works completely unmodified — no connector code to port. connector is described via a JSON-serializable spec ({ type: "dummy" | "websocket" | ... } or { type: "custom", scriptUrl, globalName, className }) since a live IConnector instance can't cross the native/web bridge.
  • Same event props as @chativa/react's <ChatIva> (onMessage, onConnect, onSurveySubmit, onWidgetOpen, ...), plus sendToChativaWebView() for live updates (e.g. theme) after mount without reloading the page.
  • A from-scratch native RN UI is tracked separately per platform as a conditional follow-up — only if the WebView approach doesn't meet the UX bar in practice: iOS (feat(react-native): true native iOS chat UI (fallback if WebView UX isn't sufficient) #29), Android (feat(react-native): true native Android chat UI (fallback if WebView UX isn't sufficient) #30).
  • examples/rn-webview-expo/ — living usage doc, scaffolded with create-expo-app for correct SDK 57 version pins.

Test plan

  • pnpm --filter @chativa/rn-webview typecheck / build (react-native-builder-bob) pass
  • pnpm --filter chativa-example-rn-webview-expo typecheck passes
  • Full workspace typecheck passes with no regressions
  • Not exercised in an actual Expo Go client/simulator — no device/emulator available in the environment this was built in. Flagged in the example's README as the gap to check first if something doesn't work.

Closes #6

🤖 Generated with Claude Code

AimTune and others added 5 commits July 27, 2026 20:19
Embeds the existing Chativa web chat widget inside a
react-native-webview, bridged to native props/callbacks, instead
of re-implementing the UI as native RN views. The widget's JS
(core + connector + UI) genuinely runs inside the WebView's own
browser engine, loaded from each package's published CDN/global
build, so every existing @chativa/connector-* package works
completely unmodified.

<ChativaWebView> exposes the same event props @chativa/react's
<ChatIva> does (onMessage, onConnect, onSurveySubmit, ...), plus
sendToChativaWebView() for live updates (e.g. theme) after mount
without reloading the page.

A from-scratch native RN UI is tracked separately per platform,
as a conditional follow-up only if this doesn't meet the UX bar
in practice: iOS (#29), Android (#30).

Adds examples/rn-webview-expo as a living usage doc.

Closes #6

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@chativa/core is already published at 0.9.0; this repo's
package.json still said 0.0.1 (the release workflow bumps
versions from the git tag, not from committed files). Needed so
pnpm publish resolves @chativa/rn-webview's workspace:*
dependency on @chativa/core to the real published version instead
of embedding 0.0.1.

Verified via `pnpm pack`: @chativa/core resolves to "0.9.0" in
the packed tarball.
@chativa/rn-webview resolves @chativa/core through its built
dist/index.d.ts (not a source alias — aliasing to source there
made react-native-builder-bob's declaration-emit mirror core's
entire source tree into rn-webview's own output, see the package
README). CI ran typecheck before build, so a fresh checkout had
no dist/ yet and rn-webview's typecheck failed with "Cannot find
module '@chativa/core'".

Verified locally: clean dist/lib, pnpm install, pnpm build, pnpm
typecheck now passes in that order.
…bview

# Conflicts:
#	.github/workflows/release.yml
#	pnpm-lock.yaml
#	tsconfig.json
@AimTune
AimTune merged commit 873af7c into main Jul 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(react-native): @chativa/react-native package (native re-implementation)

1 participant