Skip to content
Unverified: This page has not yet been anchored to automated code tests.

vox-rn-codegen API Reference (generated)

Crate: vox-rn-codegen · Version: 0.6.0 · Target: Library (lib.rs)

React Native + Expo TypeScript codegen extracted from vox-codegen.

React Native + Expo lowering for the BuildTarget::Mobile target.

This crate is one of two lowerings for Vox components. The web lowering (under vox_codegen::codegen_ts::reactive + component) consumes the same HirModule and produces React DOM + Tailwind output; this crate consumes the same HirModule and produces React Native + StyleSheet output. The HIR is the shared source of truth — there is no separate “RN HIR”.

Future split-brain protection: the vox-cli-tests harness asserts that for every Vox source under test, BOTH lowerings produce output that tsc --noEmit accepts. Any divergence in supported VUV vocabulary fails CI.

For a Vox module, [generate_rn] produces a self-contained set of files:

  • App.tsx — Expo Router root layout (when components are present).
  • <Component>.tsx — one file per component Name() { ... }. RN-flavored.
  • vox-client.ts — reused unchanged from the existing emit; HTTP layer is identical between web and mobile.
  • mobile.ts — reused unchanged (adapter contract via target="rn").
  • vox-app-contract.json, openapi.json, schemas.ts, types.ts — reused.
  • app.json, babel.config.js, metro.config.js, eas.json — Expo scaffold artifacts (one-shot, not overwritten).

What’s NOT yet emitted (will produce a clear codegen diagnostic, not silent stub)

Section titled “What’s NOT yet emitted (will produce a clear codegen diagnostic, not silent stub)”
  • @routes → expo-router file tree (see follow-on in Phase 1A.4).
  • Boolean @form fields → <Switch> (currently emits a TODO marker; users can hand-edit until the upstream HIR exposes switch metadata).
  • State machines are emitted unchanged (TypeScript-only; no React DOM coupling).
DependencyKind
vox-codegenNormal
vox-compilerNormal
vox-codegenDevelopment
vox-compilerDevelopment
ModuleDescription
component—
form—
mobile_utils—
routes—
scaffold—
StructDescription
RnCodegenOutputOutput of the RN lowering. Same shape as the web emitter’s CodegenOutput for symmetry.
FunctionDescription
generate_rnGenerate React Native + Expo TypeScript files from a Vox module. The caller is responsible for writing files. Returns Err on hard failures (e.g. unsupported features); use the diagnostics field for non-fatal warnings.