原文链接:https://medium.com/airbnb-engineering/sunsetting-react-native-1868ba28e30a
Sunsetting React Native
react-native的黄昏
This is the fourth in a series of blog posts in which we outline our experience with React Native and what is next for mobile at Airbnb.Where are we today?
Although many teams relied on React Native and had planned on using it for the foreseeable future, we were ultimately unable to meet our original goals. In addition, there were a number of technical and organizational challenges that we were unable to overcome that would have made continuing to invest in React Native a challenge.
As a result, moving forward, we are **sunsetting React Native at Airbnb **and reinvesting all of our efforts back into native.
这是一系列博客文章中的第四篇,我们概述了我们在React Native方面的经验,以及Airbnb在移动方面的下一步经验。我们今天在哪里?
尽管很多团队都依赖React Native并计划在可预见的将来使用它,但我们最终无法实现我们原来的目标。 此外,还有一些我们无法克服的技术和组织挑战,这些挑战会使React Native继续于新的挑战。
因此,我们正在把Airbnb退出React Native,并将我们所有的努力重新投入原生。
Failing to Reach Our Goals
目标尚未实现
Move Faster
When React Native worked as intended, engineers were able to move at an unparalleled speed. However, the numerous technical and organizationalissues that we outlined in this series added frustrations and unexpected delays to many projects.
开发迅速
当React Native按预期工作时,工程师能够以无与伦比的速度开发。 然而,我们将在这个系列中列出的众多技术和组织问题给许多项目增加了挫折感和意外的延迟的例子。
Maintain the Quality Bar
Recently, as React Native matured and we accumulated more expertise, we were able to accomplish a number of things that we weren’t sure were possible. We built shared element transitions, parallax, and were able to dramatically improve the performance of some screens that used to frequently drop frames. However, some technical challenges such as initialization and the async first render made meeting certain goals challenging. The lack of resources internally and externally made this even more difficult.
维护质量
最近,随着React Native的成熟,我们积累了更多专业知识,我们能够完成许多我们不确定的事情。 我们构建了共享元素转换,视差效果,并且能够显著提高过去经常丢帧的一些屏幕的性能。 然而,诸如初始化和异步优先渲染等一些技术挑战,使得满足某些目标极具挑战性。 内部和外部资源的缺乏使得这更加困难。
Write Code Once Instead of Twice
Even though code in React Native features was almost entirely shared across platforms, only a small percentage of our app was React Native. In addition, large amounts of bridging infrastructure were required to enable product engineers to work effectively. As a result, we wound up supporting code on three platforms instead of two. We saw the potential for code sharing between mobile and web and were able to share a few npm packages but beyond that, it never materialized in a meaningful way.
一次编写代码而不是两次
尽管React Native功能中的代码几乎完全是跨平台共享的,但我们的应用程序中只有一小部分是React Native。 此外,还需要大量桥接基础设施,以使产品工程师能够有效地工作。 因此,我们在三个平台而不是两个平台上支持代码。 我们看到了移动和网络之间代码共享的潜力,并且能够共享几个npm包,但除此之外,它从未以有意义的方式实现。(成也萧何 败也萧何?)
Improve the Developer Experience
The developer experience with React Native was a mixed bag. In some ways, such as build times, things were dramatically better. However, in others, such as debugging, things were much worse. The details are enumerated in part 2in this series.
改善开发者体验
React Native的开发人员经验丰富。 在某些方面,比如构建时间,事情要好得多。 但是,在其他方面,比如调试,情况则更糟糕。 细节在本系列的第2部分中列举。
Sunset Plan
Because we weren’t able to achieve our specific goals, we have decided that React Native isn’t right for us anymore. We are currently in the process of working with teams to create a healthy transition plan. We have halted all new React Native features and have plans to transition the majority of the highest-trafficked screens to native by the end of the year. This was aided by some scheduled redesigns that were going to happen regardless. Our native infrastructure team will support React Native through 2018. In 2019, we will begin to ramp down support and reduce some of the React Native overhead such as initializing the runtime on launch.
At Airbnb, we are strong believers in open source. We actively use and contribute to many open source projects around the world and have open sourced some of our React Native work as well. As we have moved away from React Native, we haven’t been able to maintain our React Native repos as well as the community deserves. To do what’s best for the community, we will be migrating some of our React Native open source work to react-native-community which we have already begun to do with react-native-maps and will do with native-navigation and lottie-react-native.
日落计划
由于我们无法实现我们的具体目标,因此我们决定React Native不再适合我们了。我们目前正在与团队合作制定健康的过渡计划。我们已经停止了所有新的React Native功能,并计划在今年年底之前将大多数最高流量的屏幕转换为本地屏幕。这得到了一些即将发生的预定重新设计的帮助。我们的本地基础架构团队将支持到2018年的React Native。在2019年,我们将开始降低支持并减少一些React Native开销,例如启动时初始化运行时。
在Airbnb,我们是开源软件的坚定信徒。我们积极使用并为世界各地的许多开源项目做出贡献,并且也开放了一些我们的React Native工作。由于我们已经离开了React Native,我们无法保持我们的React Native回购以及社区的价值。为了对社区做最好的事情,我们将把我们的一些React Native开放源代码工作迁移到react-native-community,我们已经开始使用react-native-maps,并将使用native-navigation和loottie-react -native。
It is not all bad
Although we weren’t able to achieve our goals with React Native, engineers who used React Native generally had a positive experience. Of these engineers:
- 60% would describe their experience as amazing.
- 20% were slightly positive.
- 15% were slightly negative.
- 5% were strongly negative.
63% of engineers would have chosen React Native again given the chance and 74% would consider React Native for a new project. It is worth noting that there is inherent selection bias in these results since it only surveys people who chose to use React Native.
These engineers wrote 80,000 lines of product code across 220 screens as well as 40,000 lines of javascript infrastructure. For reference, we have about 10x the amount of code and 4x the number of screens on each native platform.
这并不全是坏事
尽管我们无法通过React Native实现我们的目标,但使用React Native的工程师一般都有积极的经验。 这些工程师中:
- 60%的人将他们的体验描述为令人惊叹。
- 20%是轻微积极的。
- 15%略为负面。
- 5%强烈否定。
如果有机会,63%的工程师会再次选择React Native,74%的工程师会考虑将React Native用于新项目。 值得注意的是,这些结果中存在固有的选择偏差,因为它只调查选择使用React Native的人。
这些工程师在220个屏幕上编写了80,000行产品代码以及40,000行javascript基础结构。 作为参考,我们有大约10倍的代码量和4倍的每个本地平台上的屏幕数量。
React Native is Maturing
This series of posts reflects our experiences with React Native as of today. However, Facebook and the broader React Native community are dedicated to making React Native work for hybrid apps at scale. React Native is progressing faster than ever. There have been over 2500 commits in the last year and Facebook just announced that they are addressing some of the technical challenges we faced head-on**. **Even if we will no longer be investing in React Native, we’re excited to continue following these developments because technical wins in React native translate to real-world wins for the people around the world who use our products.
React Native正在成熟
这一系列的帖子反映了我们在今天使用React Native的经验。 但是,Facebook和更广泛的React Native社区致力于使React Native适用于混合应用程序。 React Native正在以前所未有的速度发展。 去年有超过2500次提交,Facebook刚刚宣布他们正在解决我们面临的一些技术挑战。 即使我们不再投资React Native,我们也很高兴能够继续关注这些发展,因为React native的技术优势为世界各地使用我们产品的人们带来了实实在在的成功。
Takeaways
We integrated React Native into large existing apps that continued to move at a very fast pace. Many of the difficulties we encountered were due to the hybrid model approach we took. However, our scale allowed us to take on and solve some difficult problems that smaller companies may not have had time to solve. Making React Native work seamlessly with native is possible but challenging. Every company that uses React Native will have an experience that is a unique function of their team composition, existing app, product requirements, and maturity of React Native.
When everything came together, which it did for many features, the iteration speed, quality, and developer experience matched or surpassed all of our goals and expectations. At times, it really felt like we were on the verge of changing the game for mobile development. Even though these experiences were highly encouraging, when we balanced the positives against the pain points plus the current needs and resources of our Engineering organization, we decided that it wasn’t right for us anymore.
Deciding whether to use a new platform is a major decision and depends entirely on factors unique to your team. Our experiences and reasons for moving away may not apply to your team. In fact, many companies are continuing to successfully use it today and it may still be the best choice for many others.
Although we have never stopped investing in native, sunsetting React Native frees up even more resources to make native better than ever. Follow along in the next part of this series to learn what’s new in native for us.
小贴士
我们将React Native整合到大型现有应用程序中,这些应用程序继续以非常快的速度发展。我们遇到的许多困难都是由于我们采用了混合模型方法。但是,我们的规模使我们能够承担并解决小公司可能没有时间解决的一些难题。使React Native与native无缝协作是可能的,但具有挑战性。每个使用React Native的公司都会有一种体验,这是他们的团队组合,现有应用程序,产品要求和React Native成熟度的独特功能。
当一切齐头并进时,它为许多功能所做的工作,迭代速度,质量和开发人员的体验匹配或超越了我们的所有目标和期望。有时候,我们真的觉得我们正在改变游戏的移动开发。尽管这些经历非常令人鼓舞,但当我们将积极情绪与工程组织的痛点以及当前的需求和资源相平衡时,我们认为它已不适合我们了。
决定是否使用新平台是一个重大决定,完全取决于您的团队独有的因素。我们的经历和离职原因可能不适用于您的团队。事实上,许多公司今天仍在继续成功使用它,它可能仍然是许多其他公司的最佳选择。
虽然我们从未停止过投资本地化,但日落式React Native释放出更多资源,使本地化比以往更好。请继续阅读本系列的下一部分,以了解我们的本地新功能。
This is part four in a series of blog posts highlighting our experiences with React Native and what’s next for mobile at Airbnb.
这是一系列博文中的第四部分,重点介绍了我们在React Native方面的经验以及Airbnb的移动应用。
如有侵权,请即刻告知。
网友评论