读见

原生开发已成为 Shopify 移动端的未来(2026)- Shopify

原题Native is now the future of mobile at Shopify (2026) - Shopify

约 9 分钟约 2,084 字原文英文已翻译

推荐理由Shopify 公开推翻自己在 2020 年做出的 React Native 决策,不是因为那次选择失败,而是 LLM 改变了重复实现 Swift 与 Kotlin 的成本前提。团队用 Helix 把迁移拆成小型、可审查的检查点,以测试、视觉检查和对抗性评审逐步推进,Shop 应用从概念验证到原生上线用了 12 周。这是一份难得的技术决策复盘:好架构不是永远坚持旧答案,而是在基本假设改变后重新计算。

读前速览

5 个要点

Shopify 推翻了 2020 年押注 React Native 的决定,因为 LLM 编程的进步让原生 Swift/Kotlin 开发变得更便宜、更快速,促使公司借助 Helix 等 AI 辅助工具,从零开始迁移到原生移动应用。

  1. 随着 LLM 编程缩小了与原生开发的成本差距,React Native 的跨平台优势逐渐消退。

    改进后的 LLM 现在可以参照 React Native 代码,用 Swift/Kotlin 实现功能,使原生开发更快、更便宜,促使 Shopify 重新审视其 2020 年的技术栈。

  2. LLM 辅助的原型验证表明,原生重建可以比以往更快完成。

    原型验证显示,智能体可以参照 iOS 版本实现 Android 功能,反之亦然,大幅降低了功能对齐的维护成本,并使从零开始的迁移成为可能。

  3. Helix 系统实现了增量式、审查驱动的迁移,并配有自动化检查点。

    Helix 读取 React Native 代码,提出小型、可审查的检查点,并确保每个切片都通过测试、视觉审查和对抗性代码审查后才继续推进,从而加速迁移。

  4. Shop 应用借助 AI 在 12 周内完成迁移;Shopify 主应用的迁移仍在进行中。

    借助 Helix 和 CLI 工具,Shop 应用从概念验证到生产级原生应用仅用了 12 周,规模更大的 Shopify 应用迁移也正在进行中。

  5. Shopify 继续支持关键的 React Native 库,同时归档使用较少的库。

    Skia 和 FlashList 继续获得赞助;Restyle 被归档,确保社区贡献者有足够时间适应,同时保留了生态贡献。

完整摘要

Shopify 最初在 2020 年采用 React Native 以实现跨平台效率,节省时间并让非移动端开发者也能参与贡献。到 2025-2026 年,大语言模型的进步削弱了共享代码的成本优势,使原生开发更具吸引力。公司借助 LLM 辅助,用 Swift 和 Kotlin 原型重建了核心应用,并采用名为 Helix 的新系统,将迁移拆解为可审查的检查点,并利用 CLI 实现快速、无需模拟器的反馈循环。Shop 应用仅用 12 周就完成重建,Shopify 主应用的迁移正在进行中,并计划将所有移动应用迁移至原生。Shopify 继续赞助关键的 React Native 开源库(Skia 和 FlashList),同时归档 Restyle,以确保生态稳定。文章阐述了决策依据、迁移方法、工具链及未来展望,凸显 AI 正在重塑移动工程。

目录 · 15 节
查看原文
Shopify's migration from React Native to native mobile development

我们在 2020 年决定全面采用 React Native,这一选择取得了极大的成功。我们只需构建一次功能,就节省了大量时间;没有移动开发背景的开发者也能参与应用开发;同时,我们也不必再疲于追赶各平台的功能一致性。We decided to go all-in on React Native back in 2020, and that bet has been extremely successful. We saved a ton of time building features just once, enabled developers with no mobile background to contribute to our apps, and freed ourselves from constantly chasing feature parity.

2025 年 1 月,我曾写道,React Native 的前景一片光明,Shopify 也计划继续投资其中。根据当时我们掌握的信息,这确实如此。React Native 一直为我们运作良好,至今仍是一个出色的框架。但从那以后,代码生成模型有了飞跃式的进步;对于我们的应用和团队来说,用 Swift 和 Kotlin 开发相同功能,成本已不再像过去那么高。In January 2025, I wrote that the future of React Native was bright and that Shopify planned to keep investing in it. That was true based on what we knew then. React Native was working well for us, and it remains an excellent framework. But since then, coding models have gotten dramatically better, and for our apps and our team, building the same feature in Swift and Kotlin no longer carries the cost it used to.

我们不会仅仅因为一个决定当时取得了成功,就一直坚持下去。当核心假设发生变化时,我们愿意重新审视,判断它是否仍然是正确的选择。LLM 改变了我们在 2020 年做出决定时的一项核心假设,因此我们从第一性原理出发,重新评估了我们的移动技术栈。We don’t hold on to a decision just because it was successful at the time. When a core assumption changes, we’re willing to go back and ask whether it’s still the right call. LLMs changed one of the core assumptions behind our 2020 decision, so we reevaluated our mobile stack from first principles.

我们的发现让我们重新回归原生方案。What we found led us back to native.

为什么切换回原生版本?Why switch back to native

我们决定在 2020 年从原生开发转向 React Native,原因有三点:We decided to switch from native to React Native in 2020 for three reasons:

  • 别再重复构建相同的功能了
    Stop building the same features twice
  • 让开发者能够跨整个技术栈开展工作
    Allow developers to work across the stack
  • 少花时间追赶功能对等,多花时间交付价值。
    Spend less time chasing feature parity and more time shipping value

React Native 始终为我们带来了这些优势。我们发现自己投入了大量时间和资源来优化性能、改进 React Native 的关键基础领域,并跟进框架更新和外部依赖项,但这些都是可以接受的权衡。使用 React Native 带来的收益远远超过了我们在这些方面所做的投入。React Native consistently delivered these benefits. We found ourselves spending a significant amount of time and resources on optimizing performance, improving key foundational areas in React Native, and keeping up with framework updates and external dependencies, but these were acceptable tradeoffs. The benefits of using React Native far outweighed the investments we had to make in these areas.

Shopify 自 2021 年起就开始使用 LLM 构建软件(比 ChatGPT 早一年!)。起初,我们用它们来实现功能、调查并修复错误,以及审查代码。随着模型不断进步,我们交给它们处理的工作也变得越来越复杂。到 2025 年末,它们已不再只是帮助我们更快地编写代码,还让我们开始思考:构建两次软件,是否仍意味着要做两倍的工作。Shopify has been using LLMs to build software since 2021 (one year before ChatGPT!). Initially, we used them to implement features, investigate and fix bugs, and review code. As the models improved, so did the complexity of the work we trusted them to take on. By late 2025, they were no longer just helping us write code faster. They were capable of making us question whether building software twice still meant doing twice the work.

我们决定重新评估移动技术栈,并开始制作原型,看看我们选择的技术是否依然适用。我们借助大语言模型,用 Swift 和 Kotlin 重写了几款最大型应用中的多个核心部分,结果其表现之出色令我们惊讶。智能体:We decided to reevaluate our mobile tech stack and started prototyping to see whether our technology choices still held up. We rebuilt several core parts of our biggest apps in Swift and Kotlin using LLMs and were surprised by how well it worked. Agents:

  • 可以参考 iOS 版本在 Android 上实现某项功能,反之亦然.
    Could implement a feature on Android using the iOS version as a reference, and vice versa
  • 帮助开发人员快速上手,并在其主要技术栈之外有效贡献力量
    Helped developers ramp up and contribute effectively outside their primary stack
  • 通过共享规范、测试和评审检查点,大幅降低了维护平台间一致性的成本。
    Dramatically reduced the cost of maintaining parity between platforms through shared specifications, tests, and review checkpoints

原生开发仍然意味着要在两个平台上构建和维护软件,这项成本并没有消失。变化在于,如今智能体已经能够承担足够多的实现、迁移、测试和审查工作,因此这不再像 2020 年那样是决定性因素。Native still means building and maintaining software on two platforms, that cost has not disappeared. What changed is that agents can now do enough of the implementation, translation, testing, and review work that it’s no longer the deciding factor it was in 2020.

React Native 应用可以很快。我们的应用就是如此。我们之所以做出这一改变,是因为智能体削弱了共享实现的优势,而针对每个平台单独构建的优势依然存在。原生开发让我们更贴近平台能力和第一方工具,也减少了代码与平台之间的框架和依赖层。React Native apps can be fast. Ours are. We are making this change because agents have reduced the advantages of sharing implementation, while the advantages of building for each platform remain. Native keeps us closer to platform capabilities and first-party tooling, with fewer framework and dependency layers between our code and the platform.

我们 React Native 开源库的未来The future of our React Native open-source libraries

在介绍迁移方案之前,我们想先确保这次过渡能够顺利完成。从一开始,我们就希望为 React Native 做出贡献,让它变得更好。我们发布的开源库已成为各自类别中的首选。我们非常感谢社区给予的热烈支持,并承诺确保这次过渡平稳顺利,不会出现意外。Before we get into how we’re migrating, we want to make sure we do this transition cleanly. From the beginning, we wanted to contribute back to React Native to make it better. We’ve published open-source libraries that have become the top choice in their respective categories. We’re grateful for the incredible reception from the community and are committed to making sure this is a smooth transition with no surprises.

React Native SkiaReact Native Skia

Shopify 将继续资助该项目直至 2026 年底,之后 William Candillon 也会继续维护。未来几个月,他会创建该仓库的分支,并以新名称开始发布这个库。迁移完成后,原仓库将归档。我们会在整个过程中发布进展,确保大家有充足的时间完成迁移。如果你的应用依赖这个库,请考虑资助该项目。Shopify will continue sponsoring this through the end of 2026, and William Candillon will continue working on it beyond that. He will fork the repo in the coming months and start publishing the library under a new name. The original repo will be archived when this transition is complete. We’ll post updates along the way so that everyone has ample time to migrate. If your app relies on this library, please consider sponsoring it.

FlashListFlashList

这个库每周的下载量约为 200 万次,已成为在 React Native 中渲染高性能列表的默认方式。鉴于它对整个生态系统至关重要,Shopify 将继续修复影响兼容性的严重问题。我们目前正在与几家公司讨论由谁长期维护 FlashList。如果你有兴趣,请通过这里联系我。This library gets ~2M downloads/week and has become the default way to render high-performance lists in React Native. Given how important it is for the ecosystem, Shopify will continue to fix critical issues that break compatibility. We’re currently in discussions with several companies about taking on long-term stewardship of FlashList. If you’re interested, reach out to me here.

重新设置样式Restyle

Restyle 的用户群比我们的其他库小,因此我们将把这个仓库归档。我们会继续维护并确保它正常运行至 2026 年底,之后将停止维护。欢迎任何人分叉该仓库并继续推进;如果有团队愿意接手,我们也会协助完成交接。Restyle has a smaller user base than our other libraries, so we're archiving this repo. We'll keep it working through the end of 2026, then stop maintaining it. Anyone is welcome to fork it and take it forward, and we'll help with the handover if a team wants to pick it up.

我们如何进行迁移How we’re migrating

Shopify 拥有多款重要应用(Shopify、Shop、Point of Sale 和 Inbox)。全球数百万商家和买家每天都依赖这些应用谋生,并从自己喜爱的品牌购买心仪的商品。Shopify has several large apps (Shopify, Shop, Point of Sale, Inbox). Millions of merchants and buyers around the world rely on them every single day to earn their livelihood and buy products they want from the brands they love.

我们曾讨论过,是逐步迁移到原生应用(棕地式改造),还是从头重建(绿地式开发)。过去迁移到 React Native 时,我们为一些规模最大的应用选择了棕地式改造,因为重写它们需要数年时间,而且在重写期间我们不得不停止发布新功能。We debated between gradually migrating to native (brownfield) versus rebuilding them from scratch (greenfield). In the past when we migrated to React Native, we picked the brownfield approach for some of our biggest apps, as it’d take years to rewrite them and we’d have to stop shipping new features while the rewrite was in progress.

然而,这一次,greenfield 凭借以下原因脱颖而出,成为明显的赢家:However, this time greenfield emerged as a clear winner for the following reasons:

  • LLM 擅长以 React Native 版本为参考,使用 Swift 和 Kotlin 构建功能。
    LLMs are good at building features in Swift and Kotlin using the React Native version as reference
  • 这让我们可以摆脱以往的种种限制,以尽可能理想的方式重新构建。
    It gives us a clean slate to rebuild in the best way possible without any of the previous constraints
  • 我们的原型表明,我们重建这些应用的速度远快于编程智能体出现之前。
    Our prototypes showed that we could rebuild these apps substantially faster than was possible before coding agents

在应用商店的购物类应用榜单中,Shop 应用常年名列前茅,它也成为首个完成迁移的应用。在 AI 的辅助下,团队仅用 12 周,就从概念验证阶段走到了全面重建原生应用并发布到应用商店。我们在这里深入介绍了这次迁移。The Shop app, which is regularly at the top of the list in the shopping category in the app stores, is the first to be migrated. Assisted by AI, the team was able to go from a proof of concept to a fully rebuilt native app published in the app stores in just 12 weeks. We’ve written about this migration in depth here.

Shopify 应用的迁移也已启动(这是我们规模最大的应用,拥有 300 多个屏幕、主屏幕和锁定屏幕小组件、Apple Watch 应用、表盘复杂功能、Siri 快捷指令等),并将于今年晚些时候发布。我们其余的应用也将很快完成迁移。The migration of the Shopify app (our biggest with 300+ screens, home & lockscreen widgets, Apple Watch app, complications, Siri Shortcuts, etc.), is also underway and will ship later this year. The rest of our apps will be migrated soon.

防止低质内容泛滥Preventing slop

直接让 LLM 查看 React Native 代码库,并尝试一次性用原生代码实现相同的功能,这种做法很诱人,但行不通。即使你要求它事先尽可能多地收集信息,将这些信息整理成规范和任务文件,再着手实现,最终也只会得到大量难以维护、无法发布的代码。It’s tempting to just point an LLM to the React Native codebase and try to one-shot the same features in native, but it doesn’t work. Even if you ask it to gather as much information as it can up front, freeze that into specs, task files, and then implement it, you end up with a huge amount of unmaintainable code that can’t be shipped.

为解决这个问题,我们构建了一个名为 Helix 的系统,采用更循序渐进的方法。它不要求第一次输出就正确,而是构建一个循环,让不完善的尝试无法继续推进,直到最终得到良好的结果。To solve this problem, we built a system called Helix that takes a more gradual approach. It doesn't expect the first output to be correct, and builds a loop where an imperfect attempt simply cannot move forward until it becomes a good result.

开发者将 Helix 指向一个屏幕。Helix 阅读 React Native 代码,并提出一系列检查点(规模小、顺序明确的工作切片),每个都能在几分钟内完成审查。随后,Helix 按检查点逐个构建:每个检查点都必须通过测试证明其行为符合预期,在视觉审查中与运行中的应用一致,经受两位对抗性代码审查者的检验,并获得人工认可后才能提交,然后才开始下一个检查点。每次审查的反馈都会被记住,因此随着迁移推进,这个循环会变得越来越自主。The developer points Helix at a screen. Helix reads the React Native code and proposes a sequence of checkpoints (small, ordered slices of the work) that can be reviewed in minutes. Then, checkpoint by checkpoint, it builds: each one must prove its behavior with tests, match the running app in a visual review, survive two adversarial code reviewers, and get a human's nod before it's committed and the next one starts. Feedback from every review is remembered, so the loop gets more autonomous as the migration progresses.

Helix rebuilding a screen in the Shopify mobile app using Swift and Kotlin

这种方法效果非常好,让我们能够用很短的时间重建应用。This approach has been working extremely well and is allowing us to rebuild our apps in a fraction of the time.

实现快速反馈循环Enabling fast feedback loops

智能体对模拟器的控制一直是个瓶颈。我们发现自己总得不断盯着它们,因为它们无法可靠地完成构建、测试和迭代。我们开发了一套工具,让智能体能够自主复现 Bug、修复 Bug 并验证修复结果,但这套工具速度慢且不稳定。React Native 的热模块重载有所帮助,但由于模拟器控制速度太慢,问题仍未解决。这主要是因为需要依赖无障碍树或截图来获取应用状态、执行操作并验证结果。智能体几秒钟就能修改代码,却要花好几分钟才能测试输出结果。这让迭代变得极其缓慢,而且需要大量人工操作。模型再出色也无济于事,只要它无法快速测试自己的工作成果——而在移动端,这一点尤其难以实现。Agentic control of simulators has been a bottleneck. We found ourselves constantly babysitting them as they couldn’t reliably build, test, and iterate. We built tooling to allow agents to reproduce bugs, fix them, and verify the fix autonomously but it was slow and brittle. React Native’s hot module reload helps the situation but it doesn’t solve it, due to simulator control being slow. This is primarily due to reliance on the accessibility tree, or screenshots to get the state of the app, take actions, and verify results. Agents can make code changes in seconds, but it takes them several minutes to test the output. This makes iterating extremely slow and manual. It doesn’t matter how good the model is if it can’t test its work quickly, which is especially difficult on mobile.

我们通过设计一套同时适用于人类和智能体的应用架构来解决这个问题。核心原则是,业务逻辑应与 UI 完全解耦,并能够在桌面端以无头模式运行。随后,我们通过 CLI 向智能体开放这些功能,让它们无需借助模拟器,就能以毫秒而非分钟为单位快速迭代。We’re fixing this by designing our app architecture to work for both humans and agents. The core principle here is that business logic should be completely decoupled from the UI and be able to run headlessly on desktop. We then make it available to agents via a CLI that allows them to iterate on it in milliseconds instead of minutes without involving simulators.

使用 CLI 浏览应用并执行操作Navigating the app and performing actions using the CLI

CLI 允许智能体检查应用状态、在不同部分之间导航并执行操作,而无需接触 UI。这能实现极快的反馈循环,让智能体可以连续数小时自主工作。The CLI allows agents to inspect the state of the app, navigate between different sections, and perform actions all without needing to touch the UI. This enables extremely fast feedback loops and allows agents to work autonomously for hours at a time.

需要与模拟器交互时,CLI 可以通过远程模式连接模拟器,并通过命令操控 UI,无需检查布局或无障碍树。这能实现极快的运行速度,并支持端到端测试。When simulator interaction is needed, the CLI can connect to them via a remote mode and drive the UI via commands without having to inspect the layout or the accessibility tree. This enables blazing-fast performance and E2E tests.

这是实时的(没有加速)This is real-time (not sped up)

接下来是什么What’s next

我们将利用 AI 贯穿整个过程,把所有移动应用迁移到 Swift 和 Kotlin。Shop 已经作为一款完全原生应用上线,Shopify 应用的迁移正在进行中,其余应用也很快会陆续跟进。我们正在快速推进,但不会降低标准。每次重建都必须达到或超过人们如今对性能、稳定性、无障碍体验和产品质量的期望。这不仅仅是用不同的语言重写同一批应用。我们正在重建这些应用,让人类和智能体都能快速理解、测试和修改它们。We are going to migrate all our mobile apps to Swift and Kotlin using AI throughout the process. Shop has already shipped as a fully native app, the Shopify app is underway, and the rest will follow soon. We’re moving quickly, but not by lowering the bar. Every rebuild must meet or exceed the performance, stability, accessibility, and product quality people expect today. This isn’t just the same apps rewritten in different languages. We’re rebuilding them so both humans and agents can understand, test, and change them quickly.

迁移并非终点。真正的成功意味着我们的团队能够比以往更快地为商家和买家打造更出色的体验。我们将通过产品迭代速度、应用质量,以及智能代理能够自主完成的工作量来衡量成效。The migration isn’t the finish line. Success means our teams can deliver better experiences for merchants and buyers faster than before. We’ll measure that through product velocity, app quality, and how much work agents can complete autonomously.

我们会分享一路上的心得体会,包括深入介绍 Helix、我们可由智能体寻址的架构,以及我们如何借助智能体构建移动应用。我们曾坦诚分享从 React Native 中学到的经验,也打算同样坦诚地分享这次转型的点滴。We’ll share what we learn along the way, including deeper dives into Helix, our agent-addressable architecture, and how we’re building mobile apps with agents. We were open about what we learned from React Native, and we intend to be just as open about this transition.

这是我们承担过的最具雄心的移动端工程项目之一。如果你想参与打造新一代 Shopify 移动应用,我们正在招聘移动端工程师、基础设施工程师,以及致力于 AI 与软件工程交叉领域的开发者。This is one of the most ambitious mobile engineering projects we’ve taken on. If you want to help build the next generation of Shopify’s mobile apps, we’re hiring mobile engineers, infrastructure engineers, and developers working at the intersection of AI and software engineering.

致谢Acknowledgements

如今,Native 是 Shopify 的正确选择,但在 2020 年,React Native 才是 Shopify 的正确选择。这一成功离不开那些让它成为现实的人。Native is the right choice for Shopify now, but React Native was the right choice for Shopify in 2020. That success was only possible because of the people who made it work.

MetaMeta

感谢 Meta 的 React Native 团队多年来一直出色地维护这一框架,倾听我们的反馈,并与我们紧密合作。得益于你们在架构、性能、工具链和社区建设方面的投入,如今的 React Native 已有了显著提升。Thank you to the React Native team at Meta for being excellent stewards of the framework, listening to our feedback, and working closely with us over the years. React Native is substantially better today because of your investments in its architecture, performance, tooling, and community.

威廉·坎迪隆William Candillon

感谢你创建了 React Native Skia,并将它发展到远超我们所有人想象的程度。你重新定义了 React Native 中图形和动画的可能性,我们很期待看到你接下来会将它带向何方。Thank you for creating React Native Skia and taking it much further than any of us imagined. You redefined what was possible for graphics and animation in React Native, and we’re excited to see where you take it next.

Software MansionSoftware Mansion

感谢你为 Reanimated 所做的一切,感谢你倾听我们的反馈,并帮助我们解决应用中一些最棘手的动画和性能问题。Thank you for all your work on Reanimated, for listening to our feedback, and for helping us solve some of the hardest animation and performance problems in our apps.

Shopify 工程师Shopify engineers

数百名工程师为采用 React Native、迁移我们的应用、构建共享基础、提升性能、维护集成以及回馈生态系统作出了贡献。你们中的许多人重新成为初学者,挑战了长期以来的固有观念,并在持续为商家和买家交付产品的同时,成功完成了这次转型。谢谢大家。Hundreds of engineers contributed to adopting React Native, migrating our apps, building shared foundations, improving performance, maintaining integrations, and contributing back to the ecosystem. Many of you became beginners again, challenged long-held assumptions, and made the transition successful while continuing to ship for merchants and buyers. Thank you.

React Native 社区The React Native community

感谢所有使用我们的开源库、贡献代码、报告问题、质疑我们的决策并分享所学的人。你们的贡献和反馈,包括那些尖锐的意见,都让我们的工作变得更好。Thank you to everyone who used our open-source libraries, contributed code, reported issues, challenged our decisions, and shared what you learned. Your contributions and feedback, including the spicy kind, made our work better.

过去六年积累的工具、经验和关系,将继续影响 Shopify 构建移动应用的方式。我们由衷感谢每一位参与其中的人。LinkedInThe tools, lessons, and relationships built over the past six years will continue to shape how we build mobile apps at Shopify. We’re deeply grateful to everyone who was part of it.LinkedIn

值得记下

我们在 2020 年决定全力投入 React Native,而这一押注极其成功。
LLM 改变了我们 2020 年决策背后的一个核心假设,因此我们从第一性原理重新评估了移动技术栈。
智能体:* 可以参照 iOS 版本在 Android 上实现功能,反之亦然
开发者将 Helix 指向某个屏幕。Helix 读取 React Native 代码,并提出一系列检查点(按顺序排列的小型工作切片),可在几分钟内完成审查。
CLI 让智能体能够检查应用状态、在不同板块间导航并执行操作,全程无需触碰 UI。