Knit UI
GitHub

Troubleshooting

Indexed by what you see, not by what causes it.

"property is not writable" / "Cannot read property 'default' of undefined" on Hermes

Two copies of react-native in the tree. Almost always a version mismatch between your app's pin and a library's pin.

npm ls react-native      # or: pnpm why react-native

Fix it by pinning one version for the whole project. In a pnpm workspace:

package.json
{
  "pnpm": {
    "overrides": {
      "react-native": "0.86.2",
      "react": "19.2.3"
    }
  }
}

"Another instance of Reanimated was detected"

Same class of problem, one layer up: two react-native-reanimated copies. Add react-native-reanimated (and react-native-worklets, which travels with it) to the same overrides block. A mismatched pin in any dependency is enough.

Icons or components render but the app is enormous / slow to start

You are importing a barrel that re-exports thousands of modules. @knitui/icons and @knitui/emoji are generated packages — the icons barrel alone re-exports ~6,100 modules — and the kit src-ships, so your bundler compiles what it reaches.

On Next.js, withKnitui already sets optimizePackageImports for them. Elsewhere, import the glyph directly:

import { IconCheck } from "@knitui/icons/IconCheck"; // not from the barrel

Skia canvases are blank on the web

@shopify/react-native-skia's web build captures global.CanvasKit when the module evaluates, so the WASM runtime has to be loaded before anything imports the Skia barrel:

import { loadGraphicsRuntime } from "@knitui/graphics/runtime";

await loadGraphicsRuntime(); // then, and only then:
const { GraphicCanvas } = await import("@knitui/graphics");

If several canvases blank at once, you have hit the browser's live WebGL context cap (about 16). Mount canvases one at a time, or unmount them when they scroll out of view.

An overlay renders behind everything, or not at all

Overlays teleport into the portal host mounted by Provider. Check that:

  1. there is exactly one Provider, at the root;
  2. you are not rendering an overlay above it in the tree;
  3. on the web, your content sets pointerEvents — the portal layer is pointer-events: none so its full-viewport box doesn't swallow clicks, and content needs auto or box-none to be interactive.

A dropdown closes the moment I tap an option (Android)

The tap lands while the keyboard is dismissing. The scroll container needs:

<ScrollArea keyboardShouldPersistTaps="handled">

Combobox, Select and friends set this internally — if you have built your own dropdown on ScrollArea, set it yourself.

A readOnly TextInput ignores presses (Android)

editable={false} makes Android set pointerEvents: "box-none", so no press reaches the input. When you use a read-only input as a popover trigger, drive the overlay from focus instead of press:

<Popover withPressToggle={false}>

Vertical list rows shrink to nothing

ScrollArea with scrollbars="xy" nests a horizontal ScrollView, which lets its children size to content — so rows collapse. For a vertical list, use scrollbars="y".

Collapse never opens on native

The content was measured while clipped, so its height came back as 0. Pass the cross-axis size down, or let Collapse measure with the content pinned absolute — this is handled inside the kit, so if you see it in your own height animation, that is the cause.

Storybook or Vite: "no export default" from a reanimated file

reanimated 4's web entry pulls CommonJS dependencies that need interop. Force them through the dep optimizer:

vite.config.ts
optimizeDeps: {
  include: ["react-native-reanimated", "react-native-worklets"],
}

Tamagui: a component is not being flattened

With Tamagui v2 this showed up as the warning "skipped loading N modules", and TAMAGUI_IGNORE_BUNDLE_ERRORS=1 silenced it. v3 no longer reads that variable: component discovery fails quietly and the module just falls back to runtime styling, which is always correct, only slower.

To see what the compiler skipped and why:

DEBUG=tamagui npx expo start -c          # "component discovery skipped …"
TAMAGUI_COMPILER_STATS=verbose vite build # flatten / bail counts per module

Behaviour components (styleable()) never flatten by design; see Bundler setup.

Native styles do not change after editing the theme config

Metro does not invalidate its transform cache for config edits. Restart with a cleared cache: npx expo start -c (or delete node_modules/.cache/tamagui).

NO_INSETS_ERROR at startup

SafeAreaProvider (from react-native-safe-area-context) is mounted inside Provider. Tamagui v3's provider can read safe-area context to publish the inset tokens, so the safe-area provider has to be the outer one:

<SafeAreaProvider>
  <Provider>{/* app */}</Provider>
</SafeAreaProvider>

React warns that it "does not recognize the hoverStyle prop"

A Tamagui v2 condition object (hoverStyle, pressStyle, focusStyle, focusVisibleStyle, enterStyle, exitStyle, disabledStyle) reached v3, which has no runtime path for it and forwards it to the DOM. Move the condition into the value it changes:

// before
<Box bg="color2" hoverStyle={{ bg: "color3" }} />
// after
<Box bg="color2 hover:color3" />

A hoverStyle returned from a helper and spread in survives any codemod — grep for it. When you convert such a helper, have it return the whole program (bg: "color2 hover:color3"): a caller's own bg next to the spread now replaces the hover clause as well. See Upgrading to Knit UI 1.0.

A token renders as nothing, or as literal text

  • A leftover $. p="$md" is not a v3 token. TypeScript flags it in style props; a custom prop that forwards a token is not checked, so grep for ="$.
  • Your code detects tokens by their first character. value[0] === "$" was how v2 code told a token from a raw colour; with bare names it is always false, so tokens get passed through as literals (blank icons, missing colours). Ask the config instead: resolveToken(value, "color", { theme }) ?? value from @knitui/core.
  • A space inside one colour. A space separates clauses, so rgba(0, 0, 0, 0.5) splits into garbage; write rgba(0,0,0,0.5).
  • undefined inside a template literal. py={`${compact ? undefined : "sm"}`} renders the string "undefined". Keep it an expression: py={compact ? undefined : "sm"}.

Passing undefined does not reset a prop to "off"

In v3 an explicit undefined counts as absent, so the default applies. Pass null to switch a default off.

Next.js: styles arrive a frame late

NextTamaguiProvider is missing from the root layout, or sits below the component that renders first. See Server rendering.

Still stuck?

Open an issue with the platform, the kit version, and a minimal reproduction: github.com/the-haus/knitui/issues.

Edit this page on GitHub