Skip to content

@react-native-gpui/core 0.87.0-alpha.5

Pre-release
Pre-release

Choose a tag to compare

  • The prebuilt runtime is published for Fabric only for now. scripts/prebuilt-renderers.mjs lists the renderers the workflow builds and the pin check expects; an app that selects Loom builds it from source.

  • The test driver's scroll starts a new wheel sequence each time it is called without a phase. gpui-fast latches wheel ticks less than 500 ms apart to the container the first one went to, so a second scroll sent straight after the first, at the same point, no longer stays on the first container.

  • On Windows, C sources compiled with the runtime's preinclude header (lexbor, for one) no longer fail with STL1003: msvc-preinclude.h carries its standard-library includes only for C++. The header is an input of the prebuilt runtime, so the next release has a new prebuilt.

  • gpui-fast is pinned to 1ad3cc3. The test driver's screenshot of an element draws only that element's device-pixel region (Window::render_region_to_image) instead of the whole frame cropped afterwards, which makes headless captures of small elements faster. RN_GPUI_TEST_SCREENSHOT_TIMING=1 makes the driver log each capture's time on stderr.

  • Experimental: with RN_GPUI_TEST_HEADLESS=1, a test-driver build runs on GPUI's test platform instead of AppKit, X11/Wayland or Win32, with the same bundle, bootstrap and driver socket. No window, display or window server is used, and screenshot draws the scene offscreen with Metal where a GPU is available and on the CPU (tiny-skia) where it is not, or always with GPUI_TEST_RENDERER=cpu. It runs inside a macOS sandbox that has no window server. The CPU renderer does not draw effect groups (group opacity, blur and drop-shadow filters), blend modes, masks or native views, and shell features (menus, Dock menu, tray, system clipboard, window activation and states, the accessibility tree, displays) are not available; see docs/desktop-testing.md. Needs gpui-fast de5ebfa.

  • On Windows, the Loom runtime no longer fails to compile with Cannot open include file: 'unistd.h': Loom's LoomBindingInternals.h includes it and calls nothing from it, so the Loom header variants carry an MSVC stand-in that forwards to the real header everywhere else.

  • On Windows, the Loom renderer extracts its downloaded archive with the tar that ships with the OS, so a build from a Git Bash session no longer fails with tar: Cannot connect to C: resolve failed.

  • A native root whose size changes with its tree (a page switch, a revisited page) now settles before the next display tick instead of one tick per round between the tree and the layout: while the window holds its last frame, the runtime draws the tree as soon as a batch is applied, so the root's size is reported in the same tick. Holds on revisited pages drop from 17 to 4 of 26 (0 with jsThread main), and the time to the final frame by about 4 ms with jsThread background, 4–18 ms with main. Needs gpui-fast 8ddec44.

  • With the Loom renderer, React Native's shared animation backend runs: the runtime provides its frame source, asking for frames while an animation runs and delivering one with each, so animation libraries such as Reanimated write animated props through the backend and Loom mounts them in the same frame, with no commit. An animation running through the backend counts as busy for the test driver's idle tracking, as a native animation driver does with Fabric, and a reload starts with the frame source stopped. Reanimated's layout animations on Loom need @react-native-gpui/reanimated with its Loom adapter.

  • The prebuilt runtime is published for the Loom renderer too: the prebuilt-binaries workflow builds each platform twice, against React Native and against Loom's React Native tree, and publishes prebuilt-binaries-loom-<platform>.tar.gz in the same release; the pin file has a loom section with its own input hash, which includes the pinned Loom and its header variants. A Loom app uses its archive under the same rules as a Fabric one, and project.desktop.prebuilt always can be used with Loom. Before, the Loom runtime always built from source.

  • With the Loom renderer, where JavaScript runs (jsThread) is fixed when the app is built, as Loom's iOS and Android builds fix it: RN_GPUI_JS_THREAD no longer changes it at launch. Set it in desktop/desktop.json, or with RN_GPUI_JS_THREAD or --js-thread for a build; a change rebuilds the Rust part of the runtime.

  • With the Loom renderer, a NativeRoot without a height (or a width, with fitWidth) and a NativeSlot take the size the runtime measures as the node's Loom measured size, which React commits do not replace; it was never applied, and pages of native roots stayed collapsed, overlapping and without content. A root also starts at its remembered size, as under Fabric. Needs Loom 4245aca.

  • A press on a native root's content (a kit TextView, for one) is no longer stopped by the React Native views around it when the root itself has no touch handlers, so the native elements see the whole press: dragging selects text, a click clears a selection, and the release ends it. The views around it still get their touch events.

  • A NativeRoot without a height (or, with fitWidth, a width) of its own no longer renders its component again when the runtime has measured its tree: the size goes into the node's Fabric state, which Yoga reads, so a measurement is one layout and commit. A NativeSlot gets the width the tree gives it the same way, without a render of the slot or its root. The box also starts at the size an earlier tree with the same element types and primitive props was measured at (a revisited page, identical badges), and corrects it when the measurement differs, so the window holds its last frame for new roots much less often and for less time.

  • A page of native roots (NativeRoot, and the kit components built on it) no longer shows its first frames at sizes that are about to change: a root that has just appeared, with its tree or its height still to arrive (not the content of its slots), makes the window keep showing its last frame, for at most 250 ms, until it has its size, and again if its tree grows within that time. A window that is being scrolled is not held, nor one that has already held for 200 ms in the last second, so roots that mount one after another cannot keep it on its last frame. The new page then appears in one frame at its final layout, instead of sections overlapping and moving into place. Needs gpui-fast bdecaba.

  • On Windows, a Debug build that compiles glog from source no longer fails with D8016: '/RTC1' and '/O2' command-line options are incompatible: the -g -O2 React Native's glog build adds are dropped for MSVC, where the build type sets debug info and optimization.

  • On Windows, a C++ build no longer fails with C1083: Cannot open compiler generated file: '' when a checkout's path is long: the CMake tree is named by architecture (x64, arm64) instead of the target triple, which keeps the longest ReactCommon object files under MAX_PATH, the limit cl.exe cannot write past. A cached object (ccache hit) never ran the compiler, so the failure showed only on a miss.

  • On Windows, a build with ccache installed no longer fails: the build no longer sets CCACHE_BASEDIR for MSVC, which ccache rejected in the verbatim form (\\?\D:\...) canonicalize returns, and which, once accepted, made include paths longer than MAX_PATH. ccache still caches MSVC builds, but not across checkouts.

  • open_window no longer warns about an unused mut when built for macOS or Windows.

  • Global shortcuts no longer warn that Modifiers::SUPER is deprecated: the platform key is Modifiers::META, which global-hotkey already turned SUPER into, so the shortcuts registered are the same.

  • A faded view (opacity below 1) whose nested views change no longer shows its content unfaded for a frame: gpui-fast 3bd25f1 builds a view that paints an effect group again instead of splicing it around the changed views.

  • On Windows, text inside a maskChildren mask or a view with opacity below 1 is drawn again: text in an effect group is no longer drawn with subpixel (ClearType) rendering, which left no alpha in the group.

  • A mounted view costs a fraction of the memory it did: on a grid of 10,000 text cells (21,000 views) the heap is about 13 KB per view, from 35 KB, and the physical footprint about 475 MB, from 810 MB; the renderer's share is about 6.6 KB, and no longer grows with the depth of the tree. Most of what is left is React Native's own shadow tree. Each view has one layout node (3.4 before): pointer handling wraps the view's element instead of adding a child, a Text paints its paragraph without a node of its own unless it clips to rounded corners or is translucent, and a view that takes no focus gets a focus handle only when it is pressed, focused by the test driver, or a screen reader is running. The pointer handlers of views alike are shared, a view registers three pointer listeners instead of seven, scroll state is kept only by scroll views and text-input state only by text inputs, the view props that are rarely set are kept out of line, extension props are kept parsed rather than also as JSON, and component names are shared. Needs gpui-fast 3efc3d0.

  • Moving focus, such as clicking a focusable view, no longer builds every view in the window again: gpui-fast 74dcd1f marks only the views that read the focus state of the elements that gained and lost it, and draws the rest from the last frame. Unmounting 5,000 cells built 10,514 views before and builds 7 now.

  • After a large tree is unmounted, or a window draws nothing for a second, the renderer gives back what its frames needed beyond what is on screen: element arena chunks, the spare frame's lists and the slack of the drawn frame's.

  • The test driver's layoutStats reports views, the number of React Native views mounted.

  • A change between mouse and keyboard input builds only the views that read which one was last used, instead of every view in the window: gpui-fast 841adea. Only the focused view reads it, to draw its keyboard focus ring. With 5,000 views mounted, typing in a text input right after a click reaches its onChangeText handler in 4.5 ms, from 35 ms, and the frame that shows the character in 22 ms, from 53 ms. The same holds while a screen reader is running: gpui-fast c291ac4 replays the ancestors of a view built again with their role, so a view built again inside a scroll view drawn from the last frame is still known to be inside it. Needs gpui-fast 3f7a51a.

  • A button or other control with an accessibility label of its own keeps it when it is drawn again from the last frame while a screen reader is running, instead of being named by the text inside it or left without a name: gpui-fast bcfa3e3. This fixes 3f7a51a.

  • A WebSocketClient no longer crashes with Assertion 'id_ != T::id' failed when two messages are sent at once, such as while DevTools is attached: the write slot is claimed and the next message taken under the output lock, so only one write is in flight at a time.

  • A press that begins over a NativeRoot or other native content keeps delivering its moves to the native elements and its release ends the gesture even when a native element handles the release; React ancestors used to stop the moves, so a native text view could not select by dragging, and a native button's click left the pointer gesture active.

  • The test driver's mouseDown and drag press with a click count of 1, as a real mouse does (clickCount sets it for mouseDown); the press carried a count of 0, which components that start a selection or a drag on a first click, such as a native text view, ignore.

  • A right press on React content that no View or component claims as a context menu reaches the extension component around it, so a native context menu (the kit's ContextMenu) opens over React content. Before, the press stopped at the innermost node.

  • A command sent to a codegen component inside a NativeRoot runs in the window the tree is shown in: the context's with_window gives that window, where it returned None and commands that need a window (an input's insert, say) did nothing. NativeContext::window() and NativeTree::set_window carry it.

  • NativeSlot takes clip: false lets content drawn outside the slot's box (a button hanging over an edge) show, clipped only by the native parents. A slot clips by default unless it is fit.

  • NativeRoot takes fitWidth: without a width in its style, the box is as wide as its native tree's content (its max-content width), as it is as high as it without a height. With less room it shrinks, but not below the content's min-content width, as a GPUI flex item does.

  • GPUI's own requests (an img with a URL, a remote font or vector image) are sent as GET; they went out as POST with an empty body, and a server that answers POST differently (an avatar service, say) sent back something that was not the image.

  • NativeSlot takes fit: the slot is as wide as its content instead of as wide as the native layout makes it, so a native parent that centres its children centres the content. It does not clip content that overflows it.

  • A NativeSlot whose parent in the native tree is as wide as its content (a row item, an input's prefix) takes the width of its content; before, the layout gave it no width and its content was never shown.

  • react_native_gpui::register_asset_source lets a module add a GPUI AssetSource (the icons of a component library, say) that the application loads assets from.

  • A component in a native tree reads a scalar prop that is not set as the default its spec declares (WithDefault<boolean, true> reads true), as a Fabric node does, instead of as zero.

  • react_native_gpui::native_tree::child_renderers() gives a component of a native tree one renderer per child instance, which renders that child again on demand. A component whose content is built by a closure that GPUI calls on every frame (a dialog, a popover, a table cell) uses it instead of the single-use child elements.

  • react_native_gpui::animations_disabled() is public, so a component library can follow the test driver's setAnimationsEnabled(false) the way it follows the system's reduce-motion setting.

  • NativeRoot without a height in its style is as high as its native tree's content: the runtime lays the tree out at its natural height and reports it, and the box takes it. A NativeRoot with a height behaves as before.

  • Apps choose the renderer in desktop/desktop.json: "renderer": "fabric" (the default) or "loom", the Loom renderer, and with Loom "jsThread": "background" (the default) or "main" (JavaScript on the UI thread). RN_GPUI_RENDERER and RN_GPUI_JS_THREAD override the file. Metro, autolink, the codegen and the native build all read from one React Native tree: the installed package for Fabric, Loom's copy of it for Loom. Loom is pinned by commit in ReactGpui/loom-pin.json and downloaded and verified into the shared native-dependency cache; RN_GPUI_LOOM_DIR points at a local react-native-loom package instead. A Loom build compiles the runtime from source (there is no prebuilt for it), and Reanimated is not supported with it. ReactCommonOverrides.loom holds the variants of files both Loom and core replace (NativeDOM), overrides.json records the Loom file each came from as loomBaseHash, and npm run check:loom-overrides verifies them. The JavaScript thread is a startup setting of Loom, so one native build serves both modes and changing jsThread needs no native rebuild.

  • Under Loom, the host mounts without Fabric machinery for views, paragraphs, images, scroll views, text inputs and modals: Loom's raw props are converted key by key, with React Native's own value conversions, into the renderer's flat props, and a node keeps only its frame, insets, parent and what layout must resolve later (transforms, percentage radii, directional border widths). There is no ShadowView, shadow tree, mutation, family or event emitter for them. Components with their own descriptor (host components, the per-component prop extractors, third-party libraries) keep the typed props Loom's compat layer parses once, and mount through direct ops. Window events and wheel events reach JavaScript through Loom's event manager by tag. The host takes Loom's desktop defaults (LoomSettings::configurePlatform), live scroll and location reads on any thread, a new view's first frame with its insert, a remove for an unmounted subtree's root only, and one batched release of an unmount's event targets, so it carries no workarounds of its own for them.

  • Paragraph shaping is kept: the shaped-text cache is a size-bounded LRU (by entry count and approximate bytes) instead of clearing itself whole at 256 entries, so text shaped off the main thread is still there when it is painted. Under Loom a paragraph is shaped when Loom measures it, and the layout travels with the paragraph's mount op, so the main thread paints it without shaping.

  • Under Loom, an image's or a modal's events that fire before Loom registers the node's event target are held and delivered when it is. A host component whose event target is slow to register mounts after one flush and receives its emitter with a later update, with a warning in the log.

  • Under Loom, the host builds an Image, ScrollView, TextInput, Modal or extension component's extension props only when its props or state changed, and runs a component's prop extractor only then.

  • Loom is pinned to f89ca4d: tag-keyed map nodes come from a per-container arena, commit scratch is pre-sized and released after a large commit, a paragraph's text measurements are stored once, a node's props are shared with its create operation instead of copied, and a renderer node is 320 bytes instead of 576. Loom's share of a mounted 5k-cell grid fell from 53.6 MB in 315k allocations to 50.0 MB in 258k. It also skips unchanged committed children when it selects the drafts of a commit.

  • The Loom host allocates less per op and keeps less per node. A mount op names its component with a string interned once for the process (MountOp.component is now &'static str), ops are built in place in the batch, a node's view props start from defaults without a copy and skip empty strings, the flush reuses its scratch, and the host's per-tag maps take their nodes from an arena. The host no longer keeps a separate geometry map for location reads. A 5k-cell mount makes 38% fewer allocations on the mount thread and an unmount 96% fewer, and the host keeps 1.0 MB instead of 2.7 MB for the mounted grid. The store builds the batch view it passes to store observers only when one is registered.

  • Under Loom, a node's wheel event target is released on the JavaScript thread with its instance handle.

  • With Loom's "jsThread": "main", JavaScript tasks queued on the main thread count as pending JS work, so the test driver's waitForIdle waits for a promise continuation that is still queued.

  • The test driver reports a Rust module promise call made in the last second and not yet settled as busy (modules), so waitForIdle after a press that opens a window waits for the window and the promise.

  • RN_GPUI_MOUNT_TRACE=1 logs, for every app-surface mount batch, when it was applied on the main thread and when the frame that shows it was presented, in wall-clock milliseconds that line up with JavaScript's Date.now(). The renderer benchmark reports them from the press as appliedMs and presentedMs for mount and unmount.

  • RN_GPUI_MOUNT_TRACE=1 also logs when the test driver dispatches a click or a keystroke, to measure input latency from the event.

  • gpui-fast is pinned to de5ebfa.

npm install @react-native-gpui/core@0.87.0-alpha.5

npm: https://www.npmjs.com/package/@react-native-gpui/core/v/0.87.0-alpha.5
Documentation: https://streetwriters.github.io/react-native-gpui/