Knit UI
GitHub

Expo

Expo is the shortest path to running the kit on all three platforms.

Install

npx expo install @knitui/core @knitui/components \
  react-native-gesture-handler react-native-reanimated \
  react-native-svg react-native-teleport react-native-worklets

Metro

metro.config.js
const { getDefaultConfig } = require("expo/metro-config");
const { withKnitui } = require("@knitui/plugins/metro");

module.exports = withKnitui(getDefaultConfig(__dirname));

On Tamagui v3 the compiler runs inside Metro, so babel.config.js stays the stock babel-preset-expo — no babel plugin. Upgrading an app that still lists @knitui/plugins/babel-plugin? It is now a no-op that warns; delete the line.

After any change to the theme config, restart with npx expo start -c — Metro does not invalidate its cache for config edits.

Root component

app/_layout.tsx
import { Provider } from "@knitui/core";
import { Stack } from "expo-router";

export default function RootLayout() {
  return (
    <Provider defaultColorScheme="system">
      <Stack />
    </Provider>
  );
}

Provider mounts GestureHandlerRootView for you, so you do not add one. If you add SafeAreaProvider from react-native-safe-area-context, it goes outside Provider:

<SafeAreaProvider>
  <Provider defaultColorScheme="system">
    <Stack />
  </Provider>
</SafeAreaProvider>

Tamagui v3's provider can read safe-area context to publish inset tokens, and the inverted order throws NO_INSETS_ERROR at startup.

Satellite packages with native modules

Some packages need a native module installed alongside them:

PackageAlso install
@knitui/map@maplibre/maplibre-react-native
@knitui/medianothing extra: it ships its own native module (add its config plugin)
@knitui/graphics@shopify/react-native-skia
@knitui/components (file inputs)expo-document-picker

Always through npx expo install, for the same reason as above.

Expo Go vs a development build

Everything in @knitui/components runs in Expo Go. The satellite packages that depend on native modules not bundled into Expo Go — MapLibre and Skia — need a development build.

Web

Expo's web target uses react-native-web, which the kit supports. For a content-heavy site, prefer Next.js — you get server rendering, and the Tamagui compiler flattens styles at build time.

Edit this page on GitHub