Repository navigation
@react-native-gpui/core 0.87.0-alpha.5
Pre-release-
The prebuilt runtime is published for Fabric only for now.
scripts/prebuilt-renderers.mjslists the renderers the workflow builds and the pin check expects; an app that selects Loom builds it from source. -
The test driver's
scrollstarts 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.hcarries 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'sscreenshotof 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=1makes the driver log each capture's time on stderr. -
Experimental: with
RN_GPUI_TEST_HEADLESS=1, atest-driverbuild 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, andscreenshotdraws the scene offscreen with Metal where a GPU is available and on the CPU (tiny-skia) where it is not, or always withGPUI_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; seedocs/desktop-testing.md. Needs gpui-fastde5ebfa. -
On Windows, the Loom runtime no longer fails to compile with
Cannot open include file: 'unistd.h': Loom'sLoomBindingInternals.hincludes 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
jsThreadmain), and the time to the final frame by about 4 ms withjsThreadbackground, 4–18 ms with main. Needs gpui-fast8ddec44. -
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/reanimatedwith 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.gzin the same release; the pin file has aloomsection 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, andproject.desktop.prebuiltalwayscan 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_THREADno longer changes it at launch. Set it indesktop/desktop.json, or withRN_GPUI_JS_THREADor--js-threadfor a build; a change rebuilds the Rust part of the runtime. -
With the Loom renderer, a
NativeRootwithout a height (or a width, withfitWidth) and aNativeSlottake 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 Loom4245aca. -
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
NativeRootwithout a height (or, withfitWidth, 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. ANativeSlotgets 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-fastbdecaba. -
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 -O2React 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 underMAX_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_BASEDIRfor MSVC, which ccache rejected in the verbatim form (\\?\D:\...)canonicalizereturns, and which, once accepted, made include paths longer thanMAX_PATH. ccache still caches MSVC builds, but not across checkouts. -
open_windowno longer warns about an unusedmutwhen built for macOS or Windows. -
Global shortcuts no longer warn that
Modifiers::SUPERis deprecated: the platform key isModifiers::META, whichglobal-hotkeyalready turnedSUPERinto, so the shortcuts registered are the same. -
A faded view (
opacitybelow 1) whose nested views change no longer shows its content unfaded for a frame: gpui-fast3bd25f1builds a view that paints an effect group again instead of splicing it around the changed views. -
On Windows, text inside a
maskChildrenmask or a view withopacitybelow 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
Textpaints 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-fast3efc3d0. -
Moving focus, such as clicking a focusable view, no longer builds every view in the window again: gpui-fast
74dcd1fmarks 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
layoutStatsreportsviews, 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 itsonChangeTexthandler 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-fastc291ac4replays 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-fast3f7a51a. -
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 fixes3f7a51a. -
A
WebSocketClientno longer crashes withAssertion 'id_ != T::id' failedwhen 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
NativeRootor 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
mouseDownanddragpress with a click count of 1, as a real mouse does (clickCountsets it formouseDown); 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
Viewor component claims as a context menu reaches the extension component around it, so a native context menu (the kit'sContextMenu) opens over React content. Before, the press stopped at the innermost node. -
A command sent to a codegen component inside a
NativeRootruns in the window the tree is shown in: the context'swith_windowgives that window, where it returnedNoneand commands that need a window (an input's insert, say) did nothing.NativeContext::window()andNativeTree::set_windowcarry it. -
NativeSlottakesclip:falselets 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 isfit. -
NativeRoottakesfitWidth: 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
imgwith 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. -
NativeSlottakesfit: 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
NativeSlotwhose 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_sourcelets a module add a GPUIAssetSource(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>readstrue), 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'ssetAnimationsEnabled(false)the way it follows the system's reduce-motion setting. -
NativeRootwithout aheightin 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. ANativeRootwith 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_RENDERERandRN_GPUI_JS_THREADoverride 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 inReactGpui/loom-pin.jsonand downloaded and verified into the shared native-dependency cache;RN_GPUI_LOOM_DIRpoints at a localreact-native-loompackage instead. A Loom build compiles the runtime from source (there is no prebuilt for it), and Reanimated is not supported with it.ReactCommonOverrides.loomholds the variants of files both Loom and core replace (NativeDOM),overrides.jsonrecords the Loom file each came from asloomBaseHash, andnpm run check:loom-overridesverifies them. The JavaScript thread is a startup setting of Loom, so one native build serves both modes and changingjsThreadneeds 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.componentis 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'swaitForIdlewaits 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), sowaitForIdleafter a press that opens a window waits for the window and the promise. -
RN_GPUI_MOUNT_TRACE=1logs, 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'sDate.now(). The renderer benchmark reports them from the press asappliedMsandpresentedMsfor mount and unmount. -
RN_GPUI_MOUNT_TRACE=1also 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.5npm: https://www.npmjs.com/package/@react-native-gpui/core/v/0.87.0-alpha.5
Documentation: https://streetwriters.github.io/react-native-gpui/