@solidnative-dev/fabric-host 0.0.0-stage → 0.1.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +87 -2
  3. package/dist/fatal-error-handler.d.ts +27 -0
  4. package/dist/fatal-error-handler.d.ts.map +1 -0
  5. package/dist/fatal-error-handler.js +106 -0
  6. package/dist/fatal-error-handler.js.map +1 -0
  7. package/dist/index.d.ts +7 -0
  8. package/dist/index.d.ts.map +1 -0
  9. package/dist/index.js +7 -0
  10. package/dist/index.js.map +1 -0
  11. package/dist/native-binding.d.ts +183 -0
  12. package/dist/native-binding.d.ts.map +1 -0
  13. package/dist/native-binding.js +554 -0
  14. package/dist/native-binding.js.map +1 -0
  15. package/dist/native-fabric-host.d.ts +32 -0
  16. package/dist/native-fabric-host.d.ts.map +1 -0
  17. package/dist/native-fabric-host.js +275 -0
  18. package/dist/native-fabric-host.js.map +1 -0
  19. package/dist/native-transaction.d.ts +17 -0
  20. package/dist/native-transaction.d.ts.map +1 -0
  21. package/dist/native-transaction.js +124 -0
  22. package/dist/native-transaction.js.map +1 -0
  23. package/dist/react-native-0.88.d.ts +77 -0
  24. package/dist/react-native-0.88.d.ts.map +1 -0
  25. package/dist/react-native-0.88.js +79 -0
  26. package/dist/react-native-0.88.js.map +1 -0
  27. package/dist/surface-readiness.d.ts +18 -0
  28. package/dist/surface-readiness.d.ts.map +1 -0
  29. package/dist/surface-readiness.js +43 -0
  30. package/dist/surface-readiness.js.map +1 -0
  31. package/native/README.md +502 -0
  32. package/native/SolidNativeFabric.podspec +84 -0
  33. package/native/android/SolidNativeBindingsInstaller.cpp +4218 -0
  34. package/native/android/SolidNativeBindingsInstaller.h +8 -0
  35. package/native/android/SolidNativeRuntime.cmake +61 -0
  36. package/native/android/java/dev/solidnative/runtime/SolidNativeBindingsInstaller.kt +239 -0
  37. package/native/android/java/dev/solidnative/runtime/SolidNativeDebugModule.kt +191 -0
  38. package/native/android/java/dev/solidnative/runtime/SolidNativePackage.kt +43 -0
  39. package/native/android/java/dev/solidnative/runtime/SolidNativePlatformModule.kt +81 -0
  40. package/native/android/java/dev/solidnative/runtime/SolidNativeStartupFailureView.kt +93 -0
  41. package/native/android/java/dev/solidnative/runtime/SolidNativeSurface.kt +423 -0
  42. package/native/android/solid-native.gradle +90 -0
  43. package/native/apple/SolidNativeDebugRequest.mm +421 -0
  44. package/native/fabric/SolidNativeDebugRequest.h +12 -0
  45. package/native/fabric/SolidNativeDirtyNodes.h +26 -0
  46. package/native/fabric/SolidNativeFabricApi.cpp +224 -0
  47. package/native/fabric/SolidNativeFabricApi.h +107 -0
  48. package/native/fabric/SolidNativeFabricApplication.h +32 -0
  49. package/native/fabric/SolidNativeFabricApplication.mm +373 -0
  50. package/native/fabric/SolidNativeFabricJSIBinding.h +43 -0
  51. package/native/fabric/SolidNativeFabricJSIBinding.mm +4491 -0
  52. package/native/fabric/SolidNativeFabricSmokeApplication.h +26 -0
  53. package/native/fabric/SolidNativeFabricSmokeApplication.mm +331 -0
  54. package/native/fabric/SolidNativeFabricSurface.h +63 -0
  55. package/native/fabric/SolidNativeFabricSurface.mm +549 -0
  56. package/native/fabric/SolidNativeFabricTransactionCoordinator.cpp +1275 -0
  57. package/native/fabric/SolidNativeFabricTransactionCoordinator.h +90 -0
  58. package/native/fabric/SolidNativeFabricTransactionCoordinatorApple.mm +97 -0
  59. package/native/fabric/SolidNativeRootViewController.h +20 -0
  60. package/native/fabric/SolidNativeRootViewController.mm +83 -0
  61. package/native/fabric/SolidNativeStagedNodeMap.h +104 -0
  62. package/native/fabric/SolidNativeStartupFailureView.h +17 -0
  63. package/native/fabric/SolidNativeStartupFailureView.mm +77 -0
  64. package/native/react-native-boundary.json +106 -0
  65. package/native/worklets/SolidNativeUIWorklet.cpp +1080 -0
  66. package/native/worklets/SolidNativeUIWorklet.h +245 -0
  67. package/package.json +41 -3
  68. package/scripts/verify-react-native-boundary.mjs +282 -0
@@ -0,0 +1,43 @@
1
+ import { getNativeHostBinding, readNativeSurfaceInfo, } from "./native-binding.js";
2
+ const DEFAULT_SURFACE_READY_TIMEOUT_MS = 10_000;
3
+ const MAX_SURFACE_READY_TIMEOUT_MS = 60_000;
4
+ const DEFAULT_SURFACE_READY_POLL_INTERVAL_MS = 10;
5
+ const MAX_SURFACE_READY_POLL_INTERVAL_MS = 1_000;
6
+ export class NativeSurfaceStartupError extends Error {
7
+ constructor(message) {
8
+ super(message);
9
+ this.name = "NativeSurfaceStartupError";
10
+ }
11
+ }
12
+ function boundedMilliseconds(value, name, minimum, maximum) {
13
+ if (!Number.isSafeInteger(value) || value < minimum || value > maximum) {
14
+ throw new TypeError(`${name} must be a safe integer from ${String(minimum)} through ${String(maximum)} milliseconds.`);
15
+ }
16
+ return value;
17
+ }
18
+ function nativeDelay(milliseconds) {
19
+ const timers = globalThis;
20
+ return new Promise((resolve) => timers.setTimeout(resolve, milliseconds));
21
+ }
22
+ /**
23
+ * Waits for the package-owned iOS or Android shell to publish its empty Fabric
24
+ * surface. The wait is bounded so a failed native bootstrap cannot leave a
25
+ * hidden JavaScript polling loop running indefinitely.
26
+ */
27
+ export async function waitForNativeSurface(options = {}) {
28
+ const binding = options.binding ?? getNativeHostBinding();
29
+ const timeoutMs = boundedMilliseconds(options.timeoutMs ?? DEFAULT_SURFACE_READY_TIMEOUT_MS, "timeoutMs", 0, MAX_SURFACE_READY_TIMEOUT_MS);
30
+ const pollIntervalMs = boundedMilliseconds(options.pollIntervalMs ?? DEFAULT_SURFACE_READY_POLL_INTERVAL_MS, "pollIntervalMs", 1, MAX_SURFACE_READY_POLL_INTERVAL_MS);
31
+ const startedAt = Date.now();
32
+ while (true) {
33
+ const surface = readNativeSurfaceInfo(binding);
34
+ if (surface.ready)
35
+ return surface;
36
+ const elapsed = Date.now() - startedAt;
37
+ if (elapsed >= timeoutMs) {
38
+ throw new NativeSurfaceStartupError(`The native Fabric surface was not ready within ${String(timeoutMs)} milliseconds.`);
39
+ }
40
+ await nativeDelay(Math.min(pollIntervalMs, timeoutMs - elapsed));
41
+ }
42
+ }
43
+ //# sourceMappingURL=surface-readiness.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"surface-readiness.js","sourceRoot":"","sources":["../src/surface-readiness.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,qBAAqB,GAGtB,MAAM,qBAAqB,CAAC;AAE7B,MAAM,gCAAgC,GAAG,MAAM,CAAC;AAChD,MAAM,4BAA4B,GAAG,MAAM,CAAC;AAC5C,MAAM,sCAAsC,GAAG,EAAE,CAAC;AAClD,MAAM,kCAAkC,GAAG,KAAK,CAAC;AAUjD,MAAM,OAAO,yBAA0B,SAAQ,KAAK;IAClD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAC;IAC1C,CAAC;CACF;AAED,SAAS,mBAAmB,CAC1B,KAAa,EACb,IAAY,EACZ,OAAe,EACf,OAAe;IAEf,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,OAAO,IAAI,KAAK,GAAG,OAAO,EAAE,CAAC;QACvE,MAAM,IAAI,SAAS,CACjB,GAAG,IAAI,gCAAgC,MAAM,CAAC,OAAO,CAAC,YAAY,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAClG,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,WAAW,CAAC,YAAoB;IACvC,MAAM,MAAM,GAAG,UAEd,CAAC;IACF,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC;AAC5E,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,UAAuC,EAAE;IAEzC,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,oBAAoB,EAAE,CAAC;IAC1D,MAAM,SAAS,GAAG,mBAAmB,CACnC,OAAO,CAAC,SAAS,IAAI,gCAAgC,EACrD,WAAW,EACX,CAAC,EACD,4BAA4B,CAC7B,CAAC;IACF,MAAM,cAAc,GAAG,mBAAmB,CACxC,OAAO,CAAC,cAAc,IAAI,sCAAsC,EAChE,gBAAgB,EAChB,CAAC,EACD,kCAAkC,CACnC,CAAC;IACF,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAE7B,OAAO,IAAI,EAAE,CAAC;QACZ,MAAM,OAAO,GAAG,qBAAqB,CAAC,OAAO,CAAC,CAAC;QAC/C,IAAI,OAAO,CAAC,KAAK;YAAE,OAAO,OAAO,CAAC;QAClC,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC;QACvC,IAAI,OAAO,IAAI,SAAS,EAAE,CAAC;YACzB,MAAM,IAAI,yBAAyB,CACjC,kDAAkD,MAAM,CAAC,SAAS,CAAC,gBAAgB,CACpF,CAAC;QACJ,CAAC;QACD,MAAM,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,cAAc,EAAE,SAAS,GAAG,OAAO,CAAC,CAAC,CAAC;IACnE,CAAC;AACH,CAAC"}
@@ -0,0 +1,502 @@
1
+ # Reviewed React Native Fabric boundary
2
+
3
+ This directory is the exact-release native seam for the Solid Native Fabric
4
+ backend. React Native 0.88.1 remains the only supported and device-verified
5
+ release. Application-facing packages must not include these headers or expose
6
+ React Native types.
7
+
8
+ `react-native-boundary.json` is the single native build selection. CocoaPods
9
+ reads its exact package release for every React Native pod constraint and
10
+ derives the expected normalized runtime tuple for the C++ compile guard. The
11
+ package-owned Gradle seam reads the same manifest and passes the same tuple to
12
+ CMake. React Native's own version macros must match that tuple, so neither
13
+ platform can silently compile against a different native tree merely because
14
+ its internal signatures happen to match.
15
+
16
+ The manifest is also the machine-readable review surface for the adapter. It
17
+ records every React Native, JSI, Folly, and fbjni header imported by the native
18
+ code, every `com.facebook.*` Android import, the generated Codegen headers,
19
+ CocoaPods dependencies, and Android CMake inputs. The package boundary verifier
20
+ reconstructs this inventory from source, matches it to the compatibility
21
+ package and native build wiring, and fails on any unreviewed addition, removal,
22
+ or pin change. Consumers can resolve the reviewed inventory through
23
+ `@solidnative-dev/fabric-host/react-native-boundary`.
24
+
25
+ The internal C++ namespace intentionally identifies the `react_native` backend,
26
+ not a hard-coded release. A rehearsal can therefore select a reviewed candidate
27
+ by changing the isolated candidate manifest and dependency lock without
28
+ rewriting the implementation namespace or Podspec. That compile selection is
29
+ not a support claim: the public compatibility matrix remains fail-closed until
30
+ all qualification gates are complete.
31
+
32
+ The current manifest selects React Native `0.88.1`. The CocoaPods target and
33
+ package-owned Android CMake/Kotlin seam compile the same portable transaction coordinator with
34
+ direct calls to:
35
+
36
+ - `UIManager::createNode`
37
+ - `UIManager::cloneNode`
38
+ - `UIManager::appendChild`
39
+ - `UIManager::completeSurface`
40
+ - `UIManager::dispatchCommand`
41
+ - `dom::measure`
42
+
43
+ The platform shells install a synchronous `__solidNativeHost` JSI object before
44
+ the application bundle executes. iOS installs during
45
+ `RCTHostDelegate::didInitializeRuntime`; Android uses React Native's
46
+ `BindingsInstaller` and attaches its Fabric event listener lazily at commit 1,
47
+ after Android has installed `UIManager`. Subscribed Fabric events are
48
+ intercepted ahead of React's event queue and scheduled onto the owning Hermes
49
+ runtime.
50
+
51
+ The target was compiled, linked, mounted, updated, and rollback-tested in a
52
+ generated React Native iOS application on 2026-08-19 with Xcode 26.6, the iOS
53
+ 26.5 simulator SDK, CocoaPods 1.16.2, and an iOS 15.1 deployment target. The
54
+ Hermes bundle rejected a cyclic transaction and then visibly updated the
55
+ Fabric tree through JSI.
56
+
57
+ The checked-in Release shell has exercised the same Solid-generated tree on a
58
+ physical iPhone and Pixel 9a. Both devices mounted the initial tree, routed a
59
+ press into Hermes after an AppState-driven commit, mounted the signal update,
60
+ returned non-empty current-revision layout, reclaimed every retained instance
61
+ identity, stopped the empty surface, and kept the process alive. The Android
62
+ flow is repeatable through a checked-in Release instrumentation test as well as
63
+ the manual install script. Commit 1 also contains a custom native view whose
64
+ descriptor and typed `label` prop are generated from a TypeScript Fabric spec;
65
+ its platform implementation and positive layout are verified on both devices.
66
+
67
+ Application commits construct React Native `RawProps` from values owned by the
68
+ calling Hermes runtime. RN's deprecated `folly::dynamic` constructor is isolated
69
+ to the native-only feasibility transactions, which intentionally run before a
70
+ JavaScript runtime owns the surface.
71
+
72
+ Opaque native props use a deliberately narrower path than ordinary RawProps.
73
+ The JSI binding retains up to 64 exact non-array objects in private runtime
74
+ storage and returns monotonically increasing safe-integer handles tagged by a
75
+ validated kind. The portable transaction still contains only a transport-safe
76
+ `__solidNativeResource` marker. While constructing RawProps, `FabricApi`
77
+ recognizes that marker only when it is the complete value of a direct prop and
78
+ asks the owning runtime registry for the original JSI value. Missing handles,
79
+ kind mismatches, nested use, and native-only transactions fail closed. Solid
80
+ owner cleanup releases entries, and surface teardown rejects any leak before
81
+ the binding's final defensive reclamation.
82
+
83
+ To include the compatibility target in a React Native 0.87 Podfile, resolve its
84
+ exported podspec through the application installation instead of assuming a
85
+ node_modules or monorepo layout:
86
+
87
+ ```ruby
88
+ solid_native_fabric_host_native_path = File.dirname(
89
+ Pod::Executable.execute_command('node', ['--preserve-symlinks', '-p',
90
+ 'require.resolve(
91
+ "@solidnative-dev/fabric-host/ios-podspec",
92
+ {paths: [process.argv[1]]},
93
+ )', __dir__]).strip
94
+ )
95
+ solid_native_fabric_host_native_path = Pathname
96
+ .new(solid_native_fabric_host_native_path)
97
+ .relative_path_from(Pathname.new(__dir__))
98
+ .to_s
99
+
100
+ pod 'SolidNativeFabric', :path => solid_native_fabric_host_native_path
101
+ ```
102
+
103
+ Then run `bundle exec pod install` and build the application workspace. The pod
104
+ version constraints intentionally make dependency resolution fail on a React
105
+ Native upgrade until this boundary is reviewed.
106
+
107
+ The application delegate starts the production bootstrap after it has created
108
+ its window and container view:
109
+
110
+ ```swift
111
+ private var solidNativeApplication: SolidNativeFabricApplication?
112
+
113
+ solidNativeApplication = SolidNativeFabricApplication.start(
114
+ withFactory: factory,
115
+ containerView: containerView,
116
+ launchOptions: launchOptions,
117
+ statusHandler: { status, error in
118
+ if status.hasSuffix("-failed"), let error {
119
+ SolidNativeStartupFailureView.show(in: containerView, error: error)
120
+ }
121
+ }
122
+ )
123
+ ```
124
+
125
+ `SolidNativeFabricApplication` installs Hermes/JSI, publishes one empty Fabric
126
+ revision, resets native sequence bookkeeping, and then lets JavaScript own node
127
+ allocation from commit 1. It does not mount diagnostic content or execute an
128
+ intentional failing transaction during application startup. Before constructing
129
+ `RCTHost`, it enables bridgeless legacy-module interop when React Native was
130
+ built with that fallback. This mirrors React Native 0.87's standard
131
+ `RCTRootViewFactory` ordering and lets explicitly versioned linked
132
+ `RCTBridgeModule` dependencies register before the host snapshots its module
133
+ set; it is not a generated-TurboModule compatibility claim. The boundary
134
+ verifier requires this call to remain ahead of host construction in both the
135
+ production and retained smoke bootstraps. `stop()` is idempotent, removes the
136
+ surface, disconnects the binding, and releases the `RCTHost`; it also cancels
137
+ native display-link work immediately rather than waiting for Hermes teardown.
138
+ Both start and stop are main-thread operations.
139
+
140
+ The package-owned iOS container also forwards every UIKit bounds or window
141
+ position change into the empty surface's Fabric layout constraints. Rotation,
142
+ window resizing, and embedding therefore relayout the native shadow tree rather
143
+ than merely stretching its outer `UIView` while retaining stale root bounds. It
144
+ also republishes UIKit trait changes through React Native's documented internal
145
+ notification, preserving `Appearance` delivery that its standard surface
146
+ hosting view normally owns.
147
+
148
+ For Android, apply the package-owned integration after the Android application,
149
+ AGP built-in Kotlin, and React Native plugins. Resolve it through Node so pnpm,
150
+ npm, and Yarn layouts all use the installed artifact instead of a
151
+ repository-relative source path:
152
+
153
+ ```groovy
154
+ def solidNativeAndroidGradle = file(
155
+ providers.exec {
156
+ workingDir(rootProject.projectDir)
157
+ commandLine(
158
+ "node",
159
+ "--print",
160
+ "require.resolve('@solidnative-dev/fabric-host/android-gradle')"
161
+ )
162
+ }.standardOutput.asText.get().trim()
163
+ )
164
+ apply from: solidNativeAndroidGradle
165
+ ```
166
+
167
+ The helper adds the package-owned Kotlin installer to `main` using either AGP
168
+ 9's built-in Kotlin source-set API or the external Kotlin Android plugin used
169
+ by the exact upstream React Native 0.87 template. It also passes the installed
170
+ Fabric Host directory to CMake. Include the reviewed CMake integration after React
171
+ Native creates its application target:
172
+
173
+ ```cmake
174
+ include("${SOLID_NATIVE_FABRIC_HOST_DIR}/native/android/SolidNativeRuntime.cmake")
175
+ solid_native_configure_android_target(${CMAKE_PROJECT_NAME})
176
+ ```
177
+
178
+ `SolidNativeRuntime.cmake` adds the package-owned JNI installer, portable
179
+ transaction coordinator, Fabric API, and UI-worklet evaluator to that target
180
+ with React Native's exact Folly mode. The package-artifact gate installs the
181
+ packed tarball in an isolated consumer and verifies this same entry-relative
182
+ native layout. The application's `JNI_OnLoad` includes
183
+ `SolidNativeBindingsInstaller.h` and calls
184
+ `solid_native::android::registerSolidNativeBindingsInstaller()` inside its
185
+ `fbjni` initializer. Application Kotlin passes
186
+ `dev.solidnative.runtime.SolidNativeBindingsInstaller()` to React Native's
187
+ `bindingsInstaller`. Its activity then starts the package-owned production
188
+ surface:
189
+
190
+ ```kotlin
191
+ private var solidNativeSurface: SolidNativeSurface? = null
192
+
193
+ solidNativeSurface =
194
+ SolidNativeSurface.start(
195
+ activity = this,
196
+ reactHost = nativeApplication.reactHost,
197
+ bindingsInstaller = nativeApplication.solidNativeBindingsInstaller,
198
+ )
199
+ ```
200
+
201
+ Call `solidNativeSurface?.stop()` from `onDestroy`. The controller owns empty
202
+ surface publication, UI-worklet output and pan handlers, immediate native-work
203
+ deactivation, and idempotent teardown. It waits for React Native's asynchronous
204
+ surface start before publishing and keeps the JSI surface in its destroying
205
+ state until the bounded asynchronous stop completes; startup and shutdown
206
+ failures release the remaining surface resources and are available through an
207
+ optional status handler. Before creating the surface it also derives natural
208
+ RTL from the Activity's effective application locale and synchronizes React
209
+ Native 0.87's package-scoped preferences, containing that version's incorrect
210
+ available-locale lookup at the pinned native boundary. The current installer
211
+ loads React Native's standard
212
+ `appmodules` application library; a separately packaged Android AAR and a
213
+ generated shell remain future integration work.
214
+
215
+ ## What this proves
216
+
217
+ The checked-in application now boots through
218
+ `SolidNativeFabricApplication`, the same production path exposed by the pod.
219
+ The production bootstrap and JSI binding share the private
220
+ `SolidNativeFabricSurface`; its name now reflects that it is the actual runtime
221
+ surface rather than a test fixture. The earlier
222
+ `SolidNativeFabricSmokeApplication` feasibility harness remains in the packed
223
+ version-pinned source so the original native-only mount and rollback experiment
224
+ stays reproducible, but the podspec explicitly excludes that harness from
225
+ consumer compilation through a fail-closed production source list. Both paths
226
+ start Hermes/RCTHost without requesting a
227
+ React application surface and use a Fabric surface whose module name is empty.
228
+ The coordinator validates and stages complete versioned transaction lists,
229
+ maps public component names, materializes changed shadow paths, and performs
230
+ one `completeSurface` call. The earlier simulator proof showed the diagnostic
231
+ label and emitted `jsi-installed`, `mount-succeeded`, `rollback-succeeded`, and
232
+ `jsi-update-succeeded`.
233
+
234
+ The production bootstrap commits only an empty tree and resets the logical
235
+ sequence before marking the JSI surface ready. JavaScript can therefore
236
+ allocate node 1 and own commit sequence 1 without inheriting probe nodes.
237
+ `NativeFabricHost` adapts that empty, single-runtime surface to
238
+ the framework-neutral `NativeHost`, including allocation, commits, events, measurements,
239
+ descriptors, and teardown checks that reject live nodes.
240
+
241
+ `SolidNativeRootViewController` is a pure-UIKit `UIViewController` subclass for
242
+ iOS scenes that owns view-controller-based status-bar appearance
243
+ (`UIViewControllerBasedStatusBarAppearance=true`). When
244
+ `SolidNativeFabricApplication` starts inside a view owned by
245
+ `SolidNativeRootViewController`, it exposes paired `setStatusBarStyle` and
246
+ `setStatusBarHidden` methods on `__solidNativeHost` and dispatches appearance
247
+ updates to the main thread via `setNeedsStatusBarAppearanceUpdate`, keeping
248
+ Solid Native's `<StatusBar>` working on iOS 15.1 through iOS 27+ without
249
+ touching React Native's legacy `UIApplication` status-bar APIs.
250
+
251
+ `SolidNativeStartupFailureView` is a dependency-free native last resort for a
252
+ host, JSI-binding, or initial-surface failure. It replaces an otherwise blank
253
+ container with an accessible generic message; Debug builds may append one
254
+ sanitized, bounded local diagnostic, while Release builds never expose the
255
+ supplied error. The Android equivalent takes the Activity and can be called
256
+ from `SolidNativeSurface`'s optional status handler. The binding's bounded
257
+ `reportFatalError(name, message)` handoff also lets the package-owned shell
258
+ stop a live surface and replace it with this fallback after a fatal Hermes
259
+ exception or terminal Fabric commit. Stacks and arbitrary thrown values never
260
+ cross that native boundary.
261
+
262
+ The rollback proof stages a text change followed by an illegal self-insertion.
263
+ The coordinator rejects the transaction, leaves sequence 2 unused, and then
264
+ accepts a valid sequence-2 text update. Commands are required to be the only
265
+ mutation in their transaction because their side effects cannot be rolled back.
266
+
267
+ The JSI decoder rejects undefined values, non-finite numbers, functions,
268
+ symbols, BigInts, cyclic object graphs, more than 64 levels of nesting, and
269
+ more than 100,000 transported values. The binding remains unavailable until
270
+ the empty Fabric revision is ready, serializes commits against invalidation,
271
+ and checks the exact host/backend versions at the TypeScript edge.
272
+
273
+ The built-in public mappings are `RootView`, `View`, `Pressable`, `Text`,
274
+ `Image`, `ScrollView`, `TextInput`, `ActivityIndicator`, `Modal`, `Screen`, and
275
+ `ScreenStack`. The screen components resolve through the pinned
276
+ `react-native-screens` descriptors in the application shell. Generated Fabric
277
+ component identifiers pass through to React Native's generated
278
+ descriptor registry after the JavaScript host validates their Solid Native
279
+ descriptor. Raw text is only accepted under `Text`, root views cannot be
280
+ nested, styles are flattened into Fabric props, and an unregistered generated
281
+ name fails before Fabric commits the staged tree.
282
+
283
+ Public component aliases are allowed to resolve differently at this native
284
+ boundary. In particular, `TextInput` maps to React Native's
285
+ `AndroidTextInput` descriptor on Android and `RCTTextInput` on iOS while the
286
+ Solid API and host descriptor remain platform-neutral. `ActivityIndicator`
287
+ similarly maps to `AndroidProgressBar` or `ActivityIndicatorView`; the Android
288
+ boundary supplies the constructor-only `styleAttr` and indeterminate props that
289
+ must not leak into the public Solid component.
290
+
291
+ `Modal` maps to Fabric's actual `ModalHostView` descriptor and enables only the
292
+ native event props requested by the Solid facade. Its lifecycle is deliberately
293
+ platform-aware above this seam: Android's manager ignores `visible=false` and
294
+ dismisses when structurally unmounted, whereas UIKit emits `onDismiss` from an
295
+ asynchronous completion that still needs the mounted ComponentView's
296
+ EventEmitter. Host contract version 1 exposes the binding's immutable platform
297
+ identifier so the facade can sequence those two paths without timers or a
298
+ React-owned wrapper.
299
+
300
+ Before cloning a retained node, the compatibility layer asks `UIManager` for
301
+ the newest mounted member of its ShadowNode family. Fabric views can advance
302
+ state without a Solid commit: a native TextInput edit, for example, updates its
303
+ attributed text and event count on the mounting side. Rebasing props and
304
+ children onto that newest node prevents a later controlled Solid update from
305
+ forking obsolete native state. Commands are dispatched to the newest mounted
306
+ family member for the same reason. The signed iPhone selection proof exercises
307
+ the failure-sensitive sequence: physical insertion, native state advancement,
308
+ Solid-controlled restoration, and current-value submit.
309
+
310
+ This proves the JSI call boundary, native transaction decoder, runtime-owned
311
+ Fabric node identity, and physical native-to-Hermes event route with atomic
312
+ logical staging on both platforms. The React-free application bundle also
313
+ resolves React Native's native `PlatformConstants` TurboModule through the
314
+ standard registry and awaits the platform Linking module's initial-URL promise
315
+ before mounting. It also subscribes to the native AppState module and requires
316
+ a background/foreground event before the press proof can finish. Application
317
+ code reaches PlatformConstants, Linking, AppState, Appearance, StatusBarManager,
318
+ and BackHandler through the pinned `@solidnative-dev/runtime/react-native`
319
+ service; that boundary validates payloads, owns platform subscription and
320
+ status-bar stack lifetimes, and contains React Native implementation imports. Every node
321
+ created through JSI receives a non-null `InstanceHandle` whose frozen backing
322
+ object is retained by state attached to the owning Hermes host object. Failed
323
+ commits remove their staged identities before returning to JavaScript. Deleted
324
+ identities remain retained until Fabric reports that the platform mounted the
325
+ deleting shadow-tree revision, then a task on the owning Hermes runtime releases
326
+ both the backing object and native event route. iOS observes the mounting
327
+ coordinator on its main queue; Android registers a `UIManagerMountHook` that is
328
+ called after UI-thread mount effects are visible and reads the coordinator's
329
+ mounted base revision. Both then emit a separate next-vsync lifecycle record
330
+ through `CADisplayLink` or `Choreographer`; this observes frame eligibility, not
331
+ compositor presentation. Surface teardown releases any remaining identities.
332
+
333
+ The physical Pixel proof additionally passes VisionCamera's Nitro preview
334
+ output through this resource path into its generated `PreviewView`. Android
335
+ independently observes the real camera become unavailable, finds a shown
336
+ positive-size `androidx.camera.view.PreviewView`, requires its native stream
337
+ state to equal `STREAMING`, and then observes camera release after Solid owner
338
+ disposal. This is an identity-preserving Fabric prop proof, not serialization
339
+ of a HybridObject into the public host-value domain.
340
+
341
+ `setEventHandler` installs the single runtime callback used by the renderer.
342
+ The native listener converts Fabric tags back to Solid node handles, preserves
343
+ the observed commit sequence and native priority, and suppresses React's
344
+ default dispatch for every Solid-owned tag. Events queued from an older Fabric
345
+ revision revalidate their subscription on the Hermes thread and are therefore
346
+ dropped after unsubscription or deletion instead of reaching a nonexistent
347
+ Solid node. Native screen `appear`/`disappear` events map to semantic
348
+ `focus`/`blur`; both adapters normalize them to direct default-priority
349
+ lifecycle input instead of inheriting backend input scheduling categories.
350
+ TextInput `change` maps to semantic `changeText` and is normalized to direct
351
+ discrete input so its Solid-controlled reconciliation receives user-blocking
352
+ commit priority on both platforms. `keyPress` is discrete bubbling input, and
353
+ `submitEditing` is direct discrete input; `contentSizeChange` and
354
+ `selectionChange` are direct default-priority input. TextInput `scroll` is
355
+ normalized to continuous input and `endEditing` remains a default-priority
356
+ lifecycle event. `View` layout is also a direct default-priority event. Fabric
357
+ can synchronously emit a newly mounted
358
+ view's initial layout while applying its transaction, so both bindings stage
359
+ only layout-bearing tag/event routes before native apply. A rejected commit
360
+ restores the prior route, surface, and sequence; a successful commit publishes
361
+ the complete routing graph. This preserves the first layout event without
362
+ copying the full route table on every transaction.
363
+
364
+ Subscribing sets the native
365
+ `onContentSizeChange`, `onSelectionChange`, or `onScroll` prop needed to install
366
+ the corresponding platform watcher. Android additionally receives `onKeyPress`
367
+ only when the Solid handler is subscribed, enabling its input-connection
368
+ wrapper without paying that cost for every editor. Focus, blur, and end-editing
369
+ remain default-priority lifecycle events.
370
+
371
+ The Solid facade suppresses higher-count native echoes that repeat the same
372
+ text while still advancing React Native's hidden acknowledgement count.
373
+ Multiline inputs expose the native `numberOfLines` prop and content-size
374
+ observer. With explicit transaction flushing, the controlled text commit
375
+ precedes its resulting native geometry event. Signed iPhone and Pixel runs type
376
+ two lines into the real editor, commit that value, observe native content-size
377
+ growth, observe `Enter` before the newline change, and verify that newline mode
378
+ retains focus without submit or blur.
379
+
380
+ The JSI `measure(node, afterSequence?)` call reads React Native's current
381
+ shadow-tree revision and returns parent-relative and page-relative geometry.
382
+ It rejects unmounted nodes and future sequence requirements instead of
383
+ returning stale layout. Physical iPhone and Pixel Release runs both returned
384
+ positive geometry after commits 1 and 2.
385
+
386
+ `destroySurface()` is accepted only after the coordinator's logical tree is
387
+ empty. It deactivates event routing, unregisters the Fabric listener, makes the
388
+ binding unavailable for later commits, and stops the native surface. The
389
+ renderer-facing adapter independently tracks successful create/delete
390
+ mutations and rejects premature teardown before crossing JSI.
391
+
392
+ Both platform bindings additionally install the complete version-0 native
393
+ UI-worklet boundary. A bounded graph is decoded into immutable portable C++
394
+ bytecode only after its target logical node resolves to the runtime-retained
395
+ Fabric tag.
396
+ Input updates validate complete finite vectors and monotonic timestamps before
397
+ publication. Android `Choreographer` or iOS `CADisplayLink` then evaluates the
398
+ latest vector on the main/UI thread and applies one frame of supported native
399
+ view outputs. Multiple updates awaiting the same callback coalesce without
400
+ exposing a partial vector. Cancellation is linearized with frame application;
401
+ deleting a target cancels it defensively, pending callbacks observe inactive
402
+ state, and surface handoff/teardown reports both the active graph count and the
403
+ subset with a pending native display callback. This distinguishes an installed,
404
+ idle graph from actual frame work without enumerating opaque handles. On iOS
405
+ the worklet owns its pending display-link observer explicitly, so target
406
+ deletion, owner disposal, and runtime replacement invalidate the native link
407
+ immediately instead of waiting for another display callback to release its
408
+ target cycle. The host advertises `uiWorklets` only when install, update,
409
+ destroy, and inspection methods are all present.
410
+
411
+ The optional timing extension accepts one complete target vector, a monotonic
412
+ intent timestamp, a duration of at most 60 seconds, and one of four bounded
413
+ easing curves. Each display callback interpolates and evaluates in native C++,
414
+ then schedules another callback only while the timing remains active. A newer
415
+ timing replaces it from the latest evaluated vector; an ordinary input update,
416
+ target deletion, or owner disposal cancels it. Inspection publishes bounded
417
+ progress without invoking application JavaScript from the UI thread. It also
418
+ publishes frame counts, display-timestamp bounds, global interval
419
+ minimum/maximum/mean, and nearest-rank p50/p95/p99 cadence after the first
420
+ successful timing frame. Quantiles retain at most 8,192 intervals and report
421
+ every omitted sample explicitly; aggregate counts and extrema continue for the
422
+ whole timing. iOS keeps one `CADisplayLink` alive for the timing and requests
423
+ the screen's maximum supported refresh range instead of reallocating a
424
+ one-shot link per frame. Android continues through successive `Choreographer`
425
+ callbacks. These timestamps observe the worklet's display-callback cadence,
426
+ not compositor presentation.
427
+
428
+ The optional keyframe extension accepts 1–32 complete timing targets in one
429
+ JSI call, with the same four easing curves and a 60-second cap across the whole
430
+ sequence. Every endpoint is decoded, bounded, and evaluated against the graph
431
+ before the existing driver is replaced. The shared C++ evaluator advances by
432
+ elapsed time, can cross multiple completed stages after a late callback, and
433
+ publishes duration-weighted progress plus cadence statistics for the complete
434
+ sequence. No Hermes callback is needed to start the next stage. A replacement
435
+ driver begins from the latest input vector already evaluated by the native
436
+ display loop.
437
+
438
+ The optional cancellation extension accepts a monotonic intent timestamp,
439
+ linearizes against the display callback, stops whichever timing, keyframe,
440
+ spring, or decay owns the vector, and returns the exact frozen inputs in graph
441
+ order through the same synchronous JSI call. It does not synthesize an
442
+ additional view mutation. Android removes the pending native frame token so a
443
+ late `Choreographer` callback cannot publish an identical extra sequence; iOS
444
+ clears and invalidates the owned `CADisplayLink` immediately. Existing cadence
445
+ statistics and normalized position/progress/elapsed diagnostics remain, while
446
+ spring velocity and decay speed become zero. Cancellation neither destroys the
447
+ graph nor detaches a pan recognizer.
448
+
449
+ The optional spring extension accepts the same complete target vector plus a
450
+ bounded mass, stiffness, damping, normalized initial velocity, two positive
451
+ rest thresholds, and a hard duration cap. The shared C++ evaluator uses the
452
+ closed-form damped harmonic oscillator for underdamped, critically damped, and
453
+ overdamped motion, so a given elapsed display time produces the same position
454
+ and velocity independently of refresh rate. Position is intentionally
455
+ unbounded to preserve overshoot. Meeting both rest thresholds or reaching the
456
+ duration cap snaps every input to its exact target and publishes zero velocity.
457
+ A replacement timing or spring begins from the latest evaluated vector;
458
+ immediate input, pan ownership, target deletion, and owner teardown cancel the
459
+ driver. Inspection exposes active state, normalized position/velocity, and the
460
+ same bounded cadence statistics used by timings.
461
+
462
+ The optional pan extension resolves the graph's retained platform view and
463
+ attaches one native gesture source. Gesture begin snapshots the current input
464
+ vector; change/end/cancel samples add bounded logical-unit translation to the
465
+ two selected inputs, evaluate the complete graph, and apply the output frame
466
+ synchronously on the UI thread. Attachment transfers all session inputs to
467
+ native ownership, so later JavaScript update, timing, and spring requests fail
468
+ closed until the optional detachment handshake succeeds. Detachment linearizes
469
+ with an in-flight gesture sample, stops release decay and its pending frame,
470
+ removes the Android listener or iOS recognizer, and returns the exact input
471
+ vector before JavaScript regains ownership. A malformed result leaves the
472
+ session native-owned. Target deletion, graph destruction, and surface teardown
473
+ also remove the input source and invalidate any retained callback token. An
474
+ optional nested release-decay definition hands a successful
475
+ recognizer end's logical-unit velocity directly to the existing analytical
476
+ decay driver: x/y receive their native units-per-second velocity and every
477
+ other input receives zero. Direct pan bounds do not clamp the inertial path.
478
+ The final pan vector and analytical terminal vector are both evaluated before
479
+ the handoff is published; a failure cancels all drivers atomically. Cancel does
480
+ not start decay, while the next begin interrupts any release decay still in
481
+ flight. Android recycles its `VelocityTracker` on end, cancel, detach, and
482
+ surface cleanup; iOS reads `velocityInView:` from the owned recognizer.
483
+
484
+ In particular:
485
+
486
+ - Native stack sheet presentation is exposed through `Screen`; an independent
487
+ `Sheet` is intentionally absent until it has a real native lifecycle and
488
+ detent implementation. The fixed-extent `VirtualizedList` prototype is
489
+ deliberately a Solid-owned composition over the verified ScrollView path.
490
+ Platform-owned view pooling is verified on iOS and experimentally on Android;
491
+ renderer-visible logical identity reuse and variable-height measurement
492
+ remain open.
493
+ - JavaScript-owned native surface creation and broader native-module/component
494
+ coverage remain open. `solid-native create` now generates an
495
+ application-owned iOS/Android shell that consumes the package-owned binding
496
+ and has mounted a Release signal update on a physical Pixel. Android native
497
+ sources intentionally compile into the exact application's `appmodules`
498
+ target; a prebuilt AAR is deferred until there is an ABI strategy that does
499
+ not break React Native C++ and application Codegen compatibility.
500
+
501
+ See [the feasibility record](../../../docs/fabric-spike-react-native-0.87.md)
502
+ for the complete evidence and next experiment.
@@ -0,0 +1,84 @@
1
+ require "json"
2
+
3
+ boundary = JSON.parse(
4
+ File.read(File.join(__dir__, "react-native-boundary.json"))
5
+ )
6
+ react_native_release = boundary.fetch("reactNativeVersion")
7
+ react_native_runtime_match = /\A(\d+)\.(\d+)\.(\d+)(?:[-+][0-9A-Za-z.-]+)?\z/.match(
8
+ react_native_release
9
+ )
10
+ unless react_native_runtime_match
11
+ raise "SolidNativeFabric requires an exact React Native release in react-native-boundary.json"
12
+ end
13
+ react_native_runtime_parts = react_native_runtime_match.captures
14
+
15
+ Pod::Spec.new do |spec|
16
+ spec.name = "SolidNativeFabric"
17
+ spec.version = "0.1.0-beta.0"
18
+ spec.summary = "Version-pinned React Native Fabric boundary for Solid Native."
19
+ spec.homepage = "https://solidnative.dev"
20
+ spec.license = { :type => "MIT" }
21
+ spec.author = "Solid Native contributors"
22
+ spec.source = { :path => "." }
23
+ spec.platform = :ios, "15.1"
24
+ spec.source_files = [
25
+ "apple/SolidNativeDebugRequest.mm",
26
+ "fabric/SolidNativeDebugRequest.h",
27
+ "fabric/SolidNativeDirtyNodes.h",
28
+ "fabric/SolidNativeFabricApi.cpp",
29
+ "fabric/SolidNativeFabricApi.h",
30
+ "fabric/SolidNativeFabricApplication.h",
31
+ "fabric/SolidNativeFabricApplication.mm",
32
+ "fabric/SolidNativeFabricJSIBinding.h",
33
+ "fabric/SolidNativeFabricJSIBinding.mm",
34
+ "fabric/SolidNativeFabricSurface.h",
35
+ "fabric/SolidNativeFabricSurface.mm",
36
+ "fabric/SolidNativeFabricTransactionCoordinator.cpp",
37
+ "fabric/SolidNativeFabricTransactionCoordinator.h",
38
+ "fabric/SolidNativeFabricTransactionCoordinatorApple.mm",
39
+ "fabric/SolidNativeRootViewController.h",
40
+ "fabric/SolidNativeRootViewController.mm",
41
+ "fabric/SolidNativeStagedNodeMap.h",
42
+ "fabric/SolidNativeStartupFailureView.h",
43
+ "fabric/SolidNativeStartupFailureView.mm",
44
+ "worklets/SolidNativeUIWorklet.cpp"
45
+ ]
46
+ spec.preserve_paths = "worklets/SolidNativeUIWorklet.h"
47
+ spec.public_header_files = [
48
+ "fabric/SolidNativeDebugRequest.h",
49
+ "fabric/SolidNativeFabricApplication.h",
50
+ "fabric/SolidNativeRootViewController.h",
51
+ "fabric/SolidNativeStartupFailureView.h"
52
+ ]
53
+ spec.private_header_files = [
54
+ "fabric/SolidNativeDirtyNodes.h",
55
+ "fabric/SolidNativeFabricApi.h",
56
+ "fabric/SolidNativeFabricJSIBinding.h",
57
+ "fabric/SolidNativeFabricSurface.h",
58
+ "fabric/SolidNativeFabricTransactionCoordinator.h",
59
+ "fabric/SolidNativeStagedNodeMap.h"
60
+ ]
61
+ spec.header_mappings_dir = "fabric"
62
+ spec.pod_target_xcconfig = {
63
+ "CLANG_CXX_LANGUAGE_STANDARD" => "c++20",
64
+ "DEFINES_MODULE" => "YES",
65
+ "GCC_PREPROCESSOR_DEFINITIONS" => [
66
+ "$(inherited)",
67
+ "SOLID_NATIVE_REACT_NATIVE_VERSION_MAJOR=#{react_native_runtime_parts[0]}",
68
+ "SOLID_NATIVE_REACT_NATIVE_VERSION_MINOR=#{react_native_runtime_parts[1]}",
69
+ "SOLID_NATIVE_REACT_NATIVE_VERSION_PATCH=#{react_native_runtime_parts[2]}"
70
+ ].join(" ")
71
+ }
72
+
73
+ # Deliberately narrow and version-pinned. The reviewed boundary manifest is
74
+ # the single native source of truth for both Pod resolution and the C++
75
+ # compile guard above.
76
+ spec.dependency "React-Fabric/core", "= #{react_native_release}"
77
+ spec.dependency "React-Fabric/mounting", "= #{react_native_release}"
78
+ spec.dependency "React-Fabric/uimanager", "= #{react_native_release}"
79
+ spec.dependency "React-RCTFabric", "= #{react_native_release}"
80
+ spec.dependency "React-RuntimeApple", "= #{react_native_release}"
81
+ spec.dependency "ReactCodegen"
82
+ spec.dependency "React-jsi", "= #{react_native_release}"
83
+ spec.dependency "RCT-Folly"
84
+ end