Shopify is moving from React Native back to Swift and Kotlin

Shopify is moving from React Native back to Swift and Kotlin

Shopify 决定从 React Native 迁移回 Swift 和 Kotlin

Mobile Native is now the future of mobile at Shopify 原生开发(Mobile Native)现在是 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 的原因。

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. What we found led us back to native. 我们不会仅仅因为一个决定在当时是成功的就固守它。当核心假设发生变化时,我们愿意回过头来审视它是否仍然正确。大语言模型(LLMs)改变了我们 2020 年决策背后的核心假设之一,因此我们从第一性原理出发重新评估了移动技术栈。评估结果引导我们回归原生开发。

Why switch back to native

为什么要回归原生?

We decided to switch from native to React Native in 2020 for three reasons:

  1. Stop building the same features twice
  2. Allow developers to work across the stack
  3. Spend less time chasing feature parity and more time shipping value 我们 2020 年从原生转向 React Native 是基于三个原因:
  4. 停止重复构建相同的功能;
  5. 允许开发者进行全栈开发;
  6. 减少在功能对齐上花费的时间,将更多时间用于交付价值。

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 年(ChatGPT 发布前一年!)就开始使用 LLM 构建软件。最初,我们用它们来实现功能、调查和修复 Bug 以及审查代码。随着模型能力的提升,我们交给它们处理的任务复杂度也随之增加。到 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. 我们决定重新评估移动技术栈,并开始进行原型设计,以验证我们的技术选择是否依然稳妥。我们利用 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 智能体(Agents)的作用:
  • 可以参考 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 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. React Native Skia Shopify 将继续资助该项目至 2026 年底,William Candillon 此后将继续负责维护。他将在未来几个月内 fork 该仓库,并以新名称发布该库。当过渡完成后,原仓库将被归档。我们将随时发布更新,以便大家有充足的时间进行迁移。如果您的应用依赖此库,请考虑资助它。

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. FlashList 该库每周下载量约 200 万次,已成为 React Native 中渲染高性能列表的默认方式。鉴于它对生态系统的重要性,Shopify 将继续修复破坏兼容性的关键问题。我们目前正在与几家公司讨论 FlashList 的长期管理权事宜。如果您有兴趣,请在此处联系我。

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 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. We debated between gradually migrating to native (brownfield) versus rebuilding them from scratch (greenfield). Shopify 拥有多个大型应用(Shopify, Shop, Point of Sale, Inbox)。全球数百万商家和买家每天都依赖它们来谋生或购买心仪品牌的产品。我们曾讨论过是采用逐步迁移到原生(棕地开发),还是从零开始重构(绿地开发)。

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. However, this time greenfield emerged as a clear winner for the following reasons: 过去我们迁移到 React Native 时,对一些大型应用选择了棕地开发,因为重写需要数年时间,且在重写过程中我们必须停止发布新功能。然而,这一次绿地开发(从零重构)成为了明显的赢家,原因如下:

  • 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…
  • LLM 擅长参考 React Native 版本,用 Swift 和 Kotlin 构建功能;
  • 它为我们提供了一个干净的起点,可以以最佳方式重构,而不受任何过往约束;
  • 我们的原型测试表明……