react-native-gtkx 将 React Native API 带到 Linux 桌面,通过 React reconciler 和 Yoga 布局渲染真正的 GTK4/Adwaita 控件,不使用 WebView 或 canvas。

Stars

4

7 天增长

暂无数据

Fork 数

0

开放 Issue

0

开源协议

MIT

最近更新

2026-07-31

AI 仓库情报摘要
FR-AI / ANALYSIS

为什么值得关注

它把 Linux 作为 React Native 的 out-of-tree 平台来支持,兼容标准 Metro/Vite 工具链和 Fast Refresh,并让 react-navigation 直接使用 libadwaita 原生导航控件;README 称没有其他 out-of-tree React Native 平台做到这一点。

适合谁使用

  • 希望为 Linux 桌面开发应用的 React Native 开发者
  • 对用 React/JavaScript 开发 GNOME 应用感兴趣的 Linux 开发者
  • 需要为现有 React Native 应用增加 Linux 桌面版本的团队
  • 关注 React Native 新平台和原生渲染方案的开发者

典型使用场景

  • 用熟悉的 React Native 组件创建原生 GNOME 应用
  • 通过 npx react-native run-linux 为现有 React Native 应用添加 Linux 目标
  • 构建使用 Adw.NavigationView 和 Adw.NavigationSplitView 原生导航的桌面应用
  • 使用 Vite 预设进行 Linux 优先项目的开发

项目优势

  • 渲染真实 GTK4/Adwaita 控件,无 WebView 或 canvas
  • 原生导航由 Adwaita 控件支撑,并与 react-navigation 状态保持同步
  • 性能架构避免桥接序列化;500 节点 reflow 实测 0.13–0.17 ms
  • 支持 Metro/Vite 工具链、Fast Refresh、out-of-tree platform 配置,并有 449 项测试

使用前须知

  • 仅限 Linux:要求 GTK4 >= 4.20、libadwaita >= 1.8、Node.js >= 24
  • 项目仍较年轻,API 为 v1,且依赖上游 gtkx 的改进和待清理的 workaround
  • 面向桌面场景;基于 GTK4/libadwaita 的原生导航栈不适用于其他桌面平台

README 快速开始

react-native-gtkx

React Native for the Linux desktop. Write apps against the familiar React Native API — they run as native GNOME applications on real GTK4/Adwaita widgets, with no WebView and no canvas rendering.

Under the hood: gtkx (a React reconciler for GTK4 on Node.js) + Yoga (the RN flexbox engine). The model follows react-native-web: a compatibility layer on top of another renderer, with the react-nativereact-native-gtkx alias provided by the Metro preset (Linux as a standard RN out-of-tree platformnpx react-native run-linux next to run-ios/run-android) or by the vite preset for Linux-first projects.

examples/hn-app, live in native GTK windows: a Hacker News reader on the standard React Native Metro toolchain. Tapping a card pushes a real Adw.NavigationView page — the back button, the slide and the preserved list position come from the platform, not from JS. The search field sits inside the HeaderBar (real RN content in native chrome) and queries the HN API; comments load as you scroll. The data layer is plain Node fetch — on this platform "native modules" are just Node.

And the portability proof — examples/profile renders ONE source file with both renderers, not a single @gtkx/* import in it:

react-native-gtkx (GTK4)react-native-web (browser)

Status

  • Yoga + GtkFixed spike — GO (0 px accuracy, 500-node reflow in 0.17 ms, 60 fps — docs/research/yoga-gtk-spike.md)
  • Dev environment (UTM VM with a native GNOME session, headless sway for tests) and dev workflow
  • gtkx bridge (isolation from the RC API; workaround catalog)
  • Layout engine (Yoga shadow tree, measure via Pango, batching, diffing, onLayout)
  • StyleSheet: layout/visual split, CSS Color 4 colors, PlatformColor → Adwaita
  • View / Text / Image / AppRegistry — first RN render in GTK
  • Platform

项目描述

React Native for the Linux desktop — apps on the RN API rendered as native GTK4/Adwaita widgets

相关仓库与替代方案

根据分类、Topic 和编程语言匹配的相似项目。

NUber-dev
精选
NUber-dev GitHub avatar

YTubic

YTubic is a fast, responsive, open-source YouTube Music desktop client for Windows, Linux, and macOS that uses direct InnerTube API communication and aggressive caching to provide instant navigation and playback.

Web 开发前端框架
226
TanStack
精选
TanStack GitHub avatar

router

TanStack Router is a type-safe, data-driven React router with built-in caching, prefetching, and nested layouts, while TanStack Start extends it into a full-stack SSR framework.

Web 开发前端框架
14,861
makecindy
精选
makecindy GitHub avatar

cindy

Cindy is an open-source AI agent that runs locally on your machine, integrates multiple AI harnesses and models, and provides memory, skills, and automation to perform real work in your projects and apps.

AI 与机器学习大语言模型
958