Snapchat 开源 Valdi,一个跨平台 UI 框架。
Valdi – A cross-platform UI framework

原始链接: https://github.com/Snapchat/Valdi

## Valdi:原生性能,快速开发 Valdi 是一个跨平台 UI 框架,已经在 Snap 经过了 8 年的实战考验,现在进入开源 Beta 阶段。它允许开发者使用声明式 TypeScript 编写单代码库,构建原生 iOS、Android 和 macOS 应用——**无需**依赖 WebView 或 JavaScript 桥接。 Valdi 通过自动视图回收、优化渲染和高性能 C++ 布局引擎等特性,兼顾开发者效率和运行时性能。它拥有即时热重载、完整的 VSCode 调试支持以及熟悉的 TSX 语法。 主要优势包括与现有原生应用的无缝集成(嵌入 Valdi *或* 原生组件)、对性能关键代码的多语言模块支持,以及通过自动代码生成实现与原生平台的类型安全绑定。 Valdi 目前处于 Beta 阶段,旨在完善开发者体验,采用 MIT 许可证,并通过 Discord 提供社区支持。

黑客新闻 新 | 过去 | 评论 | 提问 | 展示 | 招聘 | 提交 登录 Snapchat 开源 Valdi,一个跨平台 UI 框架 (github.com/snapchat) 8 分,by yehiaabdelm 47 分钟前 | 隐藏 | 过去 | 收藏 | 讨论 考虑申请 YC 2026 冬季批次!申请截止至 11 月 10 日 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请 YC | 联系方式 搜索:
相关文章

原文

License: MIT Platforms Status Discord TypeScript Documentation PRs Welcome

Note

Beta Status: Valdi has been widely used in Snap's production apps for the last 8 years. We're calling this a beta because our tools and documentation need more battle testing in the open source world. Valdi will exit beta when we're happy with the developer experience.

Valdi is a cross-platform UI framework that delivers native performance without sacrificing developer velocity. Write your UI once in declarative TypeScript, and it compiles directly to native views on iOS, Android, and macOS—no web views, no JavaScript bridges.

A basic Valdi component:

import { Component } from 'valdi_core/src/Component';

class HelloWorld extends Component {
  onRender() {
    const message = 'Hello World! 👻';
    <view backgroundColor='#FFFC00' padding={30}>
      <label color='black' value={message} />
    </view>;
  }
}

Hello World example running on iOS

Valdi is a cross-platform UI framework designed to solve the fundamental problem of cross-platform development: velocity vs. runtime performance. For 8 years, it has powered a large portion of Snap's production apps.

Unlike frameworks that rely on web views or JavaScript bridges, Valdi compiles declaratively rendered TypeScript components into platform-native views. Valdi also includes several other performance advantages:

  • Automatic view recycling - Global view pooling system reuses native views across all screens, dramatically reducing inflation latency
  • Optimized component rendering - Components re-render independently without triggering parent re-renders, enabling fast incremental updates
  • Optimized layout engine - C++ layout engine runs on the main thread with minimal marshalling overhead
  • Viewport-aware rendering - Only visible views are inflated, making infinite scrolling performant by default

Learn more in our Performance Optimization Guide.

Developer Experience Built for Speed

Valdi eliminates the traditional compile-test-debug cycle that slows native development:

  • Instant hot reload - See changes in milliseconds on iOS, Android, or desktop without recompiling
  • Full VSCode debugging - Set breakpoints, inspect variables, profile performance, and capture heap dumps directly in VSCode
  • Familiar syntax - TSX components with TypeScript for type safety

Valdi integrates easily into existing apps - start small and scale as needed:

  • Embed Valdi in native - Drop Valdi components into existing UIKit or Android view hierarchies
  • Embed native in Valdi - Use platform-specific views within Valdi layouts via <custom-view>
  • Polyglot modules - Write performance-critical code in C++, Swift, Kotlin, or Objective-C with type-safe bindings to TypeScript
  • Full-stack architecture - Build entire features in Valdi with worker threads for background processing, eliminating platform-specific bridge code

Valdi generates type-safe bindings between TypeScript and native platforms:

  • Automatic code generation - TypeScript interfaces compile to Kotlin, Objective-C, and Swift bindings
  • Native API access - Direct access to platform APIs and third-party native libraries through polyglot modules
  • Bidirectional communication - Pass complex data structures and callbacks between TypeScript and native code safely
  • Native protobuf support - Seamless integration with protobuf for efficient data serialization

Join our Discord for support.

Please follow the contributing guidelines.

Valdi is made available under the MIT License.

联系我们 contact @ memedata.com