Shopify 利用 AI Agent 将 React Native
Shopify moves back to Native from React Native
这是一份极具参考价值的工程复盘,详细展示了如何利用 AI Agent 解决大型应用跨框架迁移难题,Helix 系统的分阶段验证流程值得所有尝试 AI 辅助开发的团队借鉴。
blog|Mobile
博客 | 移动端
Native is now the future of mobile at Shopify
原生应用才是 Shopify 移动端的未来
Coding agents changed what it costs to build mobile apps twice. Here’s why Shopify is moving from React Native back to Swift and Kotlin.
编码代理(Coding agents)两次改变了构建移动应用的成本。这就是为什么 Shopify 正从 React Native 回归到 Swift 和 Kotlin。
Published on Sep 10, 2026
发布于 2026 年 9 月 10 日
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.
早在 2020 年,我们决定全力投入 React Native,这一赌注取得了巨大的成功。我们节省了大量时间,只需构建一次功能即可;让没有移动端背景的开发者也能参与我们的应用开发;并使我们摆脱了不断追求功能对等的困境。
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.
在 2025 年 1 月,我曾写道 React Native 的未来一片光明,Shopify 计划继续投资其中。基于当时我们所知的情况,这是事实。React Native 对我们来说运作良好,它仍然是一个优秀的框架。但自那以后,编码模型得到了显著改进,对于我们的应用和团队而言,用 Swift 和 Kotlin 构建相同功能的成本已不再像过去那样高昂。
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.
我们不会因为一个决定在当时是成功的就固守不放。当核心假设发生变化时,我们愿意回头审视,判断这是否仍然是正确的选择。LLM(大语言模型)改变了我方 2020 年决策背后的核心假设之一,因此我们从第一性原理出发重新评估了我们的移动技术栈。
What we found led us back to native.
我们的发现让我们回到了原生开发。
Why switch back to native
为何要切换回原生开发
We decided to switch from native to React Native in 2020 for three reasons:
我们在 2020 年决定从原生开发切换到 React Native,原因有三:
- 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 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.
React Native 始终能提供这些好处。我们发现自己在优化性能、改善 React Native 中关键的基础领域以及跟进框架更新和外部依赖方面花费了大量时间和资源,但这些是可以接受的权衡。使用 React Native 所带来的收益远远超过了我们在这些领域必须做出的投入。
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.
Shopify 自 2021 年起就开始使用 LLM 来构建软件(比 ChatGPT 早一年!)。起初,我们利用它们来实现功能、调查和修复错误,以及审查代码。随着模型的进步,我们委托它们承担的工作复杂度也随之提高。到了 2025 年底,它们不再仅仅是帮助我们更快地编写代码,它们甚至有能力让我们质疑:构建软件两次是否还意味着要做两倍的工作。
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:
我们决定重新评估移动技术栈,并开始进行原型设计,以检验我们的技术选型是否依然适用。我们利用 LLM 在 Swift 和 Kotlin 中重建了最大几款应用中的几个核心部分,结果令人惊讶地好。智能体(Agents):
- 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
- 可以参照 iOS 版本在 Android 上实现功能,反之亦然
- 帮助开发人员快速上手并有效贡献代码,即使是在其主技术栈之外
- 通过共享规范、测试和审查检查点,大幅降低了跨平台保持功能一致性的维护成本
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.
原生开发仍然意味着在两个平台上构建和维护软件,这种成本并未消失。发生变化的是,智能体现在能够承担足够多的实现、翻译、测试和审查工作,使其不再像 2020 年那样成为决定性因素。
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,使其变得更好。我们发布了开源库,这些库已成为各自类别的首选。我们感谢社区的热情反馈,并致力于确保这是一次平稳的过渡,没有任何意外。
React Native Skia
React Native Skia
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.
Shopify 将继续资助该项目直至 2026 年底,William Candillon 在此之后仍将继续对其进行开发。他将在未来几个月内 fork 该仓库,并开始以新名称发布该库。当此次过渡完成后,原始仓库将被归档。我们将沿途发布更新,以便大家有充足的时间进行迁移。如果您的应用依赖此库,请考虑赞助它。
FlashList
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.
该库每周下载量约为 200 万次,已成为在 React Native 中渲染高性能列表的默认方式。鉴于它对生态系统的重要性,Shopify 将继续修复破坏兼容性的关键问题。我们目前正与几家公司讨论接管 FlashList 长期维护事宜。如果您有兴趣,请在此联系我。
Restyle
Restyle
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.
Restyle 的用户基数比我们其他库小,因此我们正在归档此仓库。我们将使其在 2026 年底之前保持可用,之后停止维护。欢迎任何人 fork 该项目并继续推进,如果团队愿意接手,我们也会协助交接。
How we’re migrating
我们的迁移方式
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.
Shopify 拥有多个大型应用(Shopify、Shop、Point of Sale、Inbox)。全球数百万商家和买家每天都依赖这些应用谋生,并从他们喜爱的品牌购买产品。
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.
我们在逐步迁移到原生(brownfield)与从头重建(greenfield)之间进行了辩论。过去当我们迁移到 React Native 时,对于部分最大的应用,我们选择了 brownfield 方法,因为重写它们需要数年时间,且在重写期间我们必须停止发布新功能。
However, this time greenfield emerged as a clear winner for the following reasons:
然而,这次 greenfield 成为明确的首选,原因如下:
- 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
- LLM 擅长以 React Native 版本为参考,使用 Swift 和 Kotlin 构建功能
- 它为我们提供了一个全新的起点,使我们能够以最佳方式重建应用,而不受任何先前限制的影响
- 我们的原型显示,相较于编码代理出现之前,我们能够以更快的速度重建这些应用
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.
Shop 应用长期位居应用商店购物类榜单前列,是首个被迁移的应用。在 AI 的协助下,团队仅用 12 周时间就从概念验证过渡到完全重建的原生应用并发布至应用商店。我们在此详细记录了此次迁移过程。
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.
Shopify 应用(我们最大的应用,拥有 300+ 个屏幕、主屏幕与锁屏小组件、Apple Watch 应用、复杂组件、Siri 快捷指令等)的迁移也在进行中,预计将于今年晚些时候发布。其余应用也将很快完成迁移。
Preventing slop
防止代码质量下降
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.
人们很容易倾向于直接将 LLM 指向 React Native 代码库,并尝试一次性在原生的环境中实现相同的功能,但这行不通。即使你要求它在前期尽可能多地收集信息,将其冻结为规范、任务文件,然后进行实施,最终得到的仍是一大量无法维护且无法发布的代码。
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 的系统,采用更渐进的方法。它不期望第一次输出就是正确的,而是建立一个循环机制,使得不完美的尝试在变成良好结果之前无法继续前进。
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 指向一个屏幕。Helix 读取 React Native 代码,并提出一系列检查点(工作的微小、有序切片),这些检查点可以在几分钟内被审查。然后,逐个检查点进行构建:每个检查点都必须通过测试证明其行为,在视觉审查中与运行中的应用匹配,经受住两个对抗性代码审查员的考验,并获得人类的点头认可后才能提交,随后下一个检查点才开始。每次审查的反馈都会被记住,因此随着迁移的进行,该循环变得越来越自主。
Helix rebuilding a screen in the Shopify mobile app using Swift and Kotlin
Helix 使用 Swift 和 Kotlin 重建 Shopify 移动应用中的一个屏幕
更进一步:量化金融体系
看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力