feat: RN TurboModule -- threading + Fabric integration, rebuilt (supersedes #46) - #72
Open
DjDeveloperr wants to merge 19 commits into
Open
feat: RN TurboModule -- threading + Fabric integration, rebuilt (supersedes #46)#72DjDeveloperr wants to merge 19 commits into
DjDeveloperr wants to merge 19 commits into
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
DjDeveloperr
added a commit
that referenced
this pull request
Aug 20, 2026
Matches @nativescript/react-native's existing peerDependenciesMeta convention. Without it, npm's auto-peer-install for @nativescript/react-native-screens pulled in react-native-worklets@0.11.4 (peer react-native 0.83-0.86), conflicting with the workspace's real react-native@0.79.5 (pinned transitively via react-native-node-api) and breaking `npm install` at the repo root -- this is what CI's build job runs, and it failed on PR #72 for exactly this reason.
DjDeveloperr
added a commit
that referenced
this pull request
Aug 20, 2026
Matches @nativescript/react-native's existing peerDependenciesMeta convention. Without it, npm's auto-peer-install for @nativescript/react-native-screens pulled in react-native-worklets@0.11.4 (peer react-native 0.83-0.86), conflicting with the workspace's real react-native@0.79.5 (pinned transitively via react-native-node-api) and breaking `npm install` at the repo root -- this is what CI's build job runs, and it failed on PR #72 for exactly this reason.
DjDeveloperr
force-pushed
the
rn-turbomodule
branch
from
August 20, 2026 04:30
5bcbb48 to
c2edfcc
Compare
Build the metadata generator for the host architecture when requested. Copy the shared bridge sources required by the npm package. This fixes the Xcode 26 arm64 libclang link failure and missing-source build errors.
Add main-thread Worklets entry and dynamic Fabric component registration. The simulator test covers native calls and reentrant callbacks on the UI runtime. It also mounts two names backed by the same component implementation.
Add the Fabric component types, lifecycle hook dispatch, serialized definition store, and TypeScript authoring API. Components can define props, events, commands, child mounting, layout handling, and cleanup without project-specific native code.
Use Worklets' flat runOnUI call, serialize definitions before native registration, and create component state before any Fabric hook. Buffer early events until Fabric installs the event emitter.
The component acceptance test now covers the behavior that the spike exercised. Remove the script for the deleted spike-only API.
Describe the bridge accessor without naming a Hermes-only file so the FFI boundary check accepts the shared source.
Exercise command dispatch, mounting transactions, layout decline, content size, delegate creation, deferred work, and cleanup in the simulator app. Add reload markers so the same test can run after Worklets recreates its UI runtime.
Resolve the TypeScript dispatcher from the current JSI runtime on each call. A process-lifetime cached function could outlive its Hermes runtime and crash during destruction. The simulator test now runs through a development reload.
Forward full mounting mutations, make child hooks replace Fabric's defaults, route teardown through both recycle paths, and apply native content size during shadow-node adoption.
Make retainer helpers worklets, validate event names, expose command dispatch, reject non-worklet hooks, and clean up retained component state after teardown.
Extend the simulator app to cover the corrected mount, state, command, delegate, event, and teardown behavior.
Implement Screen and ScreenStack with defineNativeComponent. The package owns UINavigationController containment, modal presentation, prop updates, and gesture-driven pop reconciliation.
Fix worklet retainers, direct-event registration, and view-controller containment. Handle transition completion safely while the runtime lacks protocol method metadata.
Leave style out of the component's validAttributes map so React Native's style descriptor survives the view-config merge. Yoga now receives flex, size, and spacing updates.
Fabric sends only changed keys to a component. Type next and prev as Partial<Props> so hook implementations merge updates instead of replacing stored state.
Walk nested worklet closures and report undefined captures before a component mounts. The error tells authors to put mutually dependent helpers on a stable object because Worklets does not hoist transformed declarations.
Remove the content-size workaround now that Yoga receives style props. Use UIViewController completion callbacks directly and wrap the protocol-only transition callback with an explicit block signature.
Prevent npm from installing an incompatible Worklets version when the workspace already supplies React Native through react-native-node-api.
Replace the removed UIKit helper API with the current component API. Tighten the README, source comments, test output, and errors so they state the runtime contracts without internal planning notes.
DjDeveloperr
force-pushed
the
rn-turbomodule
branch
from
August 20, 2026 04:43
c2edfcc to
39d1565
Compare
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.
What this is
Threading + Fabric integration for the RN TurboModule, rebuilt from scratch after the owner rejected #46's architecture (see DECISIONS.md/ARCHITECTURE.md).
installWorkletRuntimeputs the real NativeScript interop bridge on the worklets UI runtime, so a"worklet"hook calls UIKit directly with zero JSON/RPC round-trip. The UI runtime is main-queue-scheduled but not thread-affine —runOnUISyncis banned, only async crossings allowed — so the UI/JS-thread deadlock is unconstructible rather than merely gated.API shape
One call whose hook names ARE the Fabric ObjC lifecycle names; bodies are worklets:
Proof + line counts
packages/react-native-screens/src/index.tsis a fullUINavigationControllernative stack (push/pop/modal, header config, transitionCoordinator-gated reconciliation) in 458 lines, zero native code — vs. a 16,029-lineNativeScriptScreenStack.tsxfor the same surface in the rejected #46.refactoracross both packages: 44 files, +3,366/-4,553.refactor: 55 files, +4,698/-4,561.What was deleted
The process-wide
UIView/RCTViewComponentViewmethod swizzle (NativeScriptUIView.mm),NativeScriptUIViewManager.mm,NativeScriptUIViewComponentView.{mm,h},NativeScriptUIKitHost.h,installIdleAwareWorkletsFrameLoop,BatchOps.mmand its walkers,nativeCommitObservations/nativeHandleAuthority, the point-fix RPCs, and the olddefineUIKitView/defineUIKitContainer/defineUIViewControllersurface with its registries. Grepped clean — nothing references any of it.Known caveat
UIViewControllerTransitionCoordinator's completion block is declared solely on a protocol; the metadata resolver only walks the concrete class hierarchy, so that one call site needsinterop.Block(fn, "v@?@")instead of a bare closure (seereconcileStackin the screens consumer). Class-declared completions (presentViewController:animated:completion:) already work with a bare closure. #71 fixes this at the runtime level; until it lands, protocol-declared completion params needinterop.Block.Supersedes #46.