contributor-context
Contributor context for coding agents working in this repository. Human contributors should start with `README.md` and…
<!-- GENERATED from docs/playbooks/integration/react-native-expo.md by scripts/build-agent-skill.mjs. Do not edit. -->
$ npx -y skills add crossbind/crossbind --agent claude-codeHow it fires
How this agent gets triggered: by you, by Claude, or both.
Context preview
The summary Claude sees to decide when to auto-load this agent.
<!-- GENERATED from docs/playbooks/integration/react-native-expo.md by scripts/build-agent-skill.mjs. Do not edit. -->
<!-- GENERATED from docs/playbooks/integration/react-native-expo.md by scripts/build-agent-skill.mjs. Do not edit. -->
> Persona 2 sub-playbook. The user's project is an Expo-managed React Native app. Detection: `expo` (or `@expo/cli`) + `react-native` in deps.
Add crossbind to an Expo RN app so:
crossbind needs **native** code to ship with the app, so it requires:
If the user is on Expo Go, you must walk them through `expo prebuild` first.
The web build needs neither: Metro compiles the C++ to WebAssembly in crossbind's Docker toolchain, as the Vite plugin does.
| File | Role | |------|------| | `package.json` | + `@crossbind/plugin-react-native`, `@crossbind/plugin-react-native-ios-helper` (dependencies), `@crossbind/plugin-metro` (devDependency), optional `@crossbind/port-<name>` | | `metro.config.js` | Wrap Expo's `getDefaultConfig` with `CrossbindMetroPlugin(...)` | | `crossbind.config.{js,mjs}` *(new at root)* | Project-level crossbind config | | `app.json` / `app.config.{js,ts}` | Add `"@crossbind/plugin-react-native"` to `plugins` (it ships an Expo config plugin); ensure `prebuild` is configured | | `ios/`, `android/` | Generated by `expo prebuild`; native link picks up crossbind plugin | | `src/native/` *(if user wraps own C++)* | `.h` + `.cpp` source |
pnpm add @crossbind/plugin-react-native@beta @crossbind/plugin-react-native-ios-helper@beta pnpm add -D @crossbind/plugin-metro@beta # bundling; the RN plugin brings the native toolchain, Metro builds the web wasm pnpm add -D metro-config # mergeConfig for metro.config.js, which expo/metro-config does not export pnpm add @crossbind/port-<name>@beta # optional # Add "@crossbind/plugin-react-native" to expo.plugins in app.json before prebuilding # Generate / regenerate native projects from app config pnpm expo prebuild # idempotent; safe to re-run # iOS pods cd ios && pod install && cd .. # Run pnpm expo run:android pnpm expo run:ios # Web: stage the web dependencies, then the dev server builds the wasm on the first page load pnpm crossbind-metro prepare-web && pnpm expo start --web # Web export: link the release wasm next to the exported bundle pnpm crossbind-metro prepare-web && pnpm expo export -p web --clear && pnpm crossbind-metro export-web dist
For EAS:
pnpm eas build --platform ios pnpm eas build --platform android
EAS picks up `expo prebuild` artifacts automatically; crossbind plugins kick in via the regenerated `Podfile` / `build.gradle`.
Mirror `examples/mobile-reactnative-expo/`.
`metro.config.js` (canonical for Expo):
const { getDefaultConfig } = require('expo/metro-config');
const { mergeConfig } = require('metro-config');
const CrossbindMetroPlugin = require('@crossbind/plugin-metro');
const defaultConfig = getDefaultConfig(__dirname);
const config = {
...CrossbindMetroPlugin(defaultConfig),
};
module.exports = mergeConfig(defaultConfig, config);`crossbind.config.mjs`:
import Matrix from '@crossbind/example-lib-prebuilt-matrix/crossbind.config.js';
export default {
dependencies: [
Matrix,
],
paths: {
config: import.meta.url,
},
};The web bundle loads the browser build the Vite and webpack plugins make: wasm32, single-threaded unless `crossbind.config.js` or one of its dependencies sets `target.runtime: 'mt'`.
**Not applicable for native RN.** RN runs JS on Hermes/JSC; multithread (`runtime: 'mt'`) uses pthreads via JSI. No browser headers required.
On the web, `runtime: 'mt'` needs a cross-origin isolated page:
Import C++ and Rust like JavaScript modules (WebAssembly & React Native)
Contributor context for coding agents working in this repository. Human contributors should start with `README.md` and…
<!-- GENERATED from docs/api/app.md by scripts/build-agent-skill.mjs. Do not edit. -->
<!-- GENERATED from docs/api/build-state.md by scripts/build-agent-skill.mjs. Do not edit. -->
<!-- GENERATED from docs/api/conan.md by scripts/build-agent-skill.mjs. Do not edit. -->
<!-- GENERATED from docs/api/cpp-binding-rules.md by scripts/build-agent-skill.mjs. Do not edit. -->