React Native

The same package, and it streams out of the box. One thing still needs you.

NoteThis is not a separate package

@tigerbase/client is the package for React Native too. There is nothing else to install from us. What follows is what the runtime is missing and what to do about each.

Streaming is handled for you

React Native's fetch is built on XMLHttpRequest and returns a response with no body, so the usual advice is a stack of polyfills: a streaming fetch, a ReadableStream, a TextDecoder, and a global patched before anything else imports.

You need none of them. The SDK checks once whether this runtime's fetch can stream and, where it cannot, reads the reply through XMLHttpRequest itself — whose responseText grows as the response arrives, which is the same stream by another name.

Decided once, by capability, before anything is sent. Both paths end in the same frame reader.
lib/tigerbase.ts
import { Tigerbase } from "@tigerbase/client";

// That is the whole setup. No polyfill, no patched global.
export const tigerbase = new Tigerbase({ key: "tb_your_key_here" });

NoteYou can ask which path it took

fetchCanStream() reports whether this runtime has a streaming fetch. It is information, not something to act on — the fallback is automatic either way, and cancelling with an AbortSignal works on both.

TipThe check runs before the request, on purpose

A turn that reached the server has already run a model and been charged for it. Discovering the gap from a body-less response and retrying would bill every message twice, so the decision is made from a capability test that sends nothing.

What still needs you

The visitor id — and it fails silentlyThe SDK keeps one in localStorage, which React Native does not have. It falls back to a fresh id, so every launch is a new person and the agent remembers nothing. Pass your own — see below.
applyTheme — does nothingIt writes CSS custom properties onto a DOM element, and there is no DOM. Read the colours from config() and style your own components; the contrast helpers are pure arithmetic and work unchanged.
The domain allowlistA native request carries no Origin header. See the warning below before you ship.

Give the visitor a real id

Minimal

typescript
const chat = tigerbase.conversation({ id: storedVisitorId });

Realistic

lib/visitor.ts
import AsyncStorage from "@react-native-async-storage/async-storage";

export async function visitorId(): Promise<string> {
  const existing = await AsyncStorage.getItem("tigerbase.visitor");
  if (existing) return existing;
  const made = `rn-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
  await AsyncStorage.setItem("tigerbase.visitor", made);
  return made;
}

// Once, when the chat screen mounts
const chat = tigerbase.conversation({ id: await visitorId() });

WarningAlways pass id on React Native

Leave it out and the SDK mints one, fails to store it, and mints another next launch — without an error, because losing storage is a supported case on the web. It looks completely fine while you test, because you are testing one session; it shows up as an agent that cannot remember a conversation from an hour ago.

Use your own customer id instead when people sign in — opaque, 1 to 64 letters, digits or . _ : @ -. The conversation then follows them to a new phone, which a device-scoped id never does.

Colours, without applyTheme

components/AskButton.tsx
import { readableOn } from "@tigerbase/client/contrast";

const agent = await tigerbase.config();
const brand = agent.primaryColor ?? "#dc2626";

<View style={{ backgroundColor: brand }}>
  {/* Computed, not assumed: white on a pale brand is not hard to
      read, it is absent — and whoever chose the colour never notices,
      because they already know what the button says. */}
  <Text style={{ color: readableOn(brand) }}>Ask</Text>
</View>

@tigerbase/client/contrast is pure arithmetic with no DOM in it, so it works here unchanged. It is the same rule the web widget uses. readableOn returns "#000000" or "#ffffff".

Before you ship

CarefulNative requests carry no Origin, and production refuses them

The agent’s publishable key is guarded by its allowed-domains list, read from the request’s Origin or Referer. A browser always sends one; a React Native app does not. In production the public endpoints refuse a request with neither, so a release build fails with forbidden_origin (status 403, reason no_origin) while everything worked against a local backend. This is a current limitation of the platform: there is no setting today that lets a native app through.

Test against the hosted API before you ship, not only against a development server, where this check is relaxed.

All of it

  1. 1

    Install the package

    bash
    npm install @tigerbase/client
  2. 2

    Pass your own visitor id

    From AsyncStorage, or your own customer id. This is the one thing the SDK cannot do for you, and the one that fails quietly.

  3. 3

    Test a release build against the hosted API

    Where the missing Origin header shows up.

If you were expecting a polyfill section, it was removed when the fallback moved into the SDK — which is where it belonged.