Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.insito.app/llms.txt

Use this file to discover all available pages before exploring further.

The SDK ships as a single npm package: @insito/react-native. It works in Expo managed, Expo bare, and CLI React Native projects.

Requirements

PeerMinimum version
react18.0
react-native0.72
@react-native-async-storage/async-storage1.21
If you’re on Expo SDK 50 or newer, all three are already in your project. Otherwise install them with your package manager.

Install

npm install @insito/react-native @react-native-async-storage/async-storage
The SDK uses AsyncStorage as a peer dependency for the persistent response queue (responses survive bad networks and app cold-starts). If your project already uses AsyncStorage, no extra setup is needed.

Native rebuild

If you’re on bare React Native, run a native rebuild once after install — npx pod-install on iOS, then rebuild your dev client. Expo managed workflows pick this up automatically on the next expo start.

Initialise the SDK

MicroSurvey.init() boots the singleton. Call it once, as early as possible — module top-level is fine.
app/_layout.tsx
import { MicroSurvey } from "@insito/react-native";

MicroSurvey.init({
  apiKey: "proj_xxx",
  debug: __DEV__,
});
init() validates the key (proj_xxx format) and throws synchronously if it’s malformed — easier to catch in development than a delayed network error.

Wire up the provider

<InsitoProvider> is the React layer that renders the modal. Put it near the root of your tree, inside your navigation container.
app/_layout.tsx
import { InsitoProvider, MicroSurvey } from "@insito/react-native";
import { Stack } from "expo-router";

export default function RootLayout() {
  return (
    <InsitoProvider>
      <Stack />
    </InsitoProvider>
  );
}
<InsitoProvider> MUST sit inside a SafeAreaProvider (Expo apps already include one). Without safe areas, the modal will clip on devices with notches.

Identify your user

Once a user signs in (or as early as you have a stable userId), call identify(). The SDK caches identity for 24 hours so repeat sessions are free.
import { useEffect } from "react";
import { MicroSurvey } from "@insito/react-native";

useEffect(() => {
  void MicroSurvey.identify({
    userId: "user-from-your-auth-system",
    platform: "ios",
    appVersion: "1.0.0",
  });
}, []);
See Configure for the full InsitoConfig schema, API reference for every method, and the example app for a working Expo Router setup.