refactor: migrate native module from Expo Modules API to React Native Turbo Modules#149
Merged
Conversation
… Turbo Modules Closes #148
09e4936 to
2ef632e
Compare
Add root babel.config.js with @react-native/babel-preset for Voltra node tests on RN 0.83, wire babel-jest to the monorepo root, and restore server/payload re-exports used by tests. Fix example app.json android plugin JSON, remove an unused expo-plugin import, and apply Prettier. Co-authored-by: Cursor <cursoragent@cursor.com>
Clean was running after build:expo-plugin and deleted expo-plugin/build before publish/CI prebuild, causing config plugin resolution to fail. Co-authored-by: Cursor <cursoragent@cursor.com>
4 tasks
## Summary Follow-up to #149. The package split was done mostly automatically, leaving behind a few cases of code duplication. This PR finishes the cleanup. - **Delete `packages/ios/src/renderer/` shims** — 7 one-liner re-export files (`context-registry`, `dispatcher`, `element-registry`, `flatten-styles`, `render-cache`, `stylesheet-registry`, `types`) were left over from the split, making `@use-voltra/ios` look like it had its own renderer. Removed them and cleaned up the barrel `index.ts`. - **Re-export `createVoltraComponent` from core** — the implementation was duplicated verbatim in `@use-voltra/ios` and `@use-voltra/android`. Core already owns and exports it — both platform packages now re-export from there. Internal consumers within each package continue to import from the local path, transparently resolving through the re-export. ### What was considered but left alone - `chart-types.ts` (`ChartDataPoint`, `SectorDataPoint`) — identical 2-line type file in both platform packages. Moving to core would give a platform-agnostic renderer package chart-domain knowledge. Duplication is acceptable at this size. - `useUpdateOnHMR.ts` — identical 20-line RN hook in both client packages. Uses `__DEV__` and Metro's `global.__accept`, so it can't go to core. No appropriate shared home without a new package for 20 lines. - `widgets/server-credentials.ts` — near-identical in `@use-voltra/ios-client` and `@use-voltra/android-client`, differing only in the native module import, error message platform label, and caller. The differences are genuine platform facts; there is no valid shared home (clients cannot depend on each other, and both are restricted from importing `@use-voltra/core` directly). - `VoltraRNNativeComponent.ts` — present in both client `native/` dirs, differing only in the registered native view name (`'VoltraView'` vs `'AndroidVoltraView'`). Intentional — different native components for each platform. - `fonts.ts` across expo-plugins — not actually duplicated. `packages/expo-plugin/src/utils/fonts.ts` is a shared utility; the platform-specific plugin files (`ios-client/expo-plugin` and `android-client/expo-plugin`) import `resolveFontPaths` from it. Structure is correct. - Lint rules for RN/expo in `@use-voltra/ios` and `@use-voltra/android` — already in place in #149. - Dependency audit — all packages clean; RN and expo only appear in `peerDependencies`. ## Test plan - [x] `tsc --noEmit` passes on `@use-voltra/ios` and `@use-voltra/android` - [x] `@use-voltra/ios` test suite passes (5/5) - [x] `@use-voltra/android` test suite passes (6/6) - [x] `oxlint` passes on all changed packages
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why this matters
This branch finishes the move away from the old monolithic
voltrapackage and lands the package layout that matches how the library is actually structured now.Instead of shipping one mixed package with Expo Modules-era assumptions, Voltra is now split into explicit platform and responsibility-focused workspaces:
@use-voltra/ios-clientand@use-voltra/android-clientfor React Native client APIs and native bindings@use-voltra/iosand@use-voltra/androidfor platform JSX/runtime packages@use-voltra/ios-server,@use-voltra/android-server, and@use-voltra/serverfor server rendering flows@use-voltra/generatoras the private source of truth for generated component metadata@use-voltra/expo-pluginas shared plugin utilities used by the client packagesThe branch also removes the old
packages/voltraworkspace entirely, updates docs/examples to the new install/import paths, and adds regression coverage around renderer/server/generator behavior so the split is safer to maintain.Closes #148
What changed
Package and workspace restructuring
@use-voltra/ios-clientand@use-voltra/android-client@use-voltra/iosand@use-voltra/android@use-voltra/server,@use-voltra/ios-server,@use-voltra/android-server@use-voltra/generatorworkspacepackages/voltrapackage instead of keeping it as a compatibility layerNative and plugin integration cleanup
codegenConfigto iOS and Android client packages@use-voltra/expo-pluginShared rendering and server changes
Tests and CI
@use-voltra/corerenderer@use-voltra/iosrenderer@use-voltra/androidrenderer@use-voltra/server@use-voltra/ios-server@use-voltra/android-server@use-voltra/generatorturbo run testDocs and examples
@use-voltra/ios-client/@use-voltra/android-clientTest plan
npm run test:js)VoltraView, eventsVoltraView, events