React Native / Expo
Status: move the logic, keep the toolchain. Metro (the RN bundler) and
the Expo CLI’s start don’t run under 3va yet. Reducers, validation,
formatting and API clients do, with their tests. See
example 11 and example 12.
What we tried
3va create expo-app expo-app --template blank-typescript
cd expo-app1. 3va create isn’t sandboxed. It runs create-expo-app through
npm exec. That scaffolder then runs npm install itself, which leaves a
package-lock.json and a node_modules behind. That install runs
lifecycle scripts, with no 3va permissions involved.
2. 3va install is blocked by the scanner. On a fresh install, 10
packages are rejected: commander, open, metro-runtime, @expo/env,
@expo/metro-config, @expo/expo-modules-macros-plugin,
react-devtools-core and @react-native/debugger-frontend (some in two
versions). expo itself now passes. Trust the reviewed versions in
"3va": { "trusted": [...] } (or use --no-scan), and the install
completes (about 2.5 min for the blank template).
3. The Expo CLI loads, Metro doesn’t:
$ 3va run node_modules/expo/bin/cli --allow-read --allow-write --allow-env \
--allow-net --allow-child-process -- --version
57.0.27
$ 3va run node_modules/expo/bin/cli … -- start
TypeError: _nodeModule(...).default._nodeModulePaths is not a function
at resolveFrom
at getExpoSDKVersionFromPackagerequire("module")._nodeModulePaths isn’t implemented in 3va’s module
builtin, so Expo can’t even read its config.
4. 3va dev is not for React Native. 3va create expo-app prints
Next steps: 3va install && 3va dev, but 3va dev tries to web-bundle
react-native itself and fails on its image assets
(…/react-native/Libraries/Image/foo.png: No such file or directory).
A setup that works today
{
"scripts": {
"start": "expo start",
"android": "expo run:android",
"test": "3va test"
}
}- Install and run Metro/Expo with npm (or your current package manager).
- Keep business logic in plain
.tsfiles that don’t importreact-nativeorexpo-*. They run and test under 3va without an emulator (3va run src/logic.ts --allow-read=./src,3va test). - Run build/codegen scripts with
3va runand exact permissions.
Things to keep in mind
- Component tests (
@testing-library/react-native,jest-expopresets,jest.mockof native modules) belong to the RN Jest setup.3va testcovers pure logic. - EAS builds, native modules and
expo prebuildare outside 3va’s scope. - Bare React Native (
@react-native-community/cli) uses the same Metro and has the same limitations.