Facebook Massive refactoring is underway React Native

A few days ago ,Facebook Just released React Native 0.56, And then ,React Engineering Manager Sophie Alpert Announced on its official blog that they are going to refactor React Native, Make it lighter , More adaptable JavaScript The development of ecosphere .

 React Native Application status of

Sophie Alpert say , stay Facebook Inside , They value... More than ever React Native, It has been used for Facebook On many important projects . Including one of their most popular products Marketplace, Monthly 8 Billion people use .

React Native It's also starting to be used elsewhere in the application , If readers watched last month F8 keynote speech , You will find Blood Donations、Crisis Response、Privacy Shortcuts and Wellness Checks All the new features of are using React Native Built .

Facebook Projects other than the main application are also in use React Native. new Oculus Go VR The mobile app corresponding to the headset is fully used React Native structure .

Sophie Alpert Express ,React Native Our goal has never been to replace other technologies , They focus on React Native Oneself , Try to make it better , But they want to see other teams from React Native Get some ideas or inspiration from , For example, apply instant reload technology to non JavaScript In the code .


React Native The project was designed to be JavaScript And native applications .React DOM take React The status update of becomes imperative 、 Variable DOM API call , Such as document.createElement(attrs) and .appendChild(), and React Native Then return a separate JSON news , It lists some actions to perform , Such as [["createView", attrs], ["manageChildren", ...]].

They designed the whole system to never rely on getting synchronous responses , And make sure that everything in the list can be fully serialized to JSON, And can be deserialized back .

This is to increase flexibility : On top of this architecture , You can build things like Chrome Tools like debuggers , These tools are available through WebSocket Connect to run all... Asynchronously JavaScript Code .

In the past 5 In the year , They found that the initial design principles made it more difficult to develop certain features . Asynchronous bridging (asynchronous bridge) It means that you can't directly JavaScript There's a lot of original logic API Integrate together , Because of the original API It's synchronous .

Batch bridging ( Local call queue ) signify React Native It's more difficult for applications to call local functions . And serial bridging means unnecessary duplication , Because it's not directly sharing memory between two worlds . For full use React Native Built applications , These limits are usually tolerable . But for in React Native Applications with complex integration with existing application code , It's bad .

therefore ,Facebook On right React Native Large scale refactoring , Make the framework more flexible , And better with JavaScript / Native infrastructure integration in native hybrid applications .

Through this project , They will apply to the past 5 What I learned in 2000 , Gradually modernize the architecture . They're reconstructing React Native Inside , Most of the work is done at the bottom , The existing React Native The application hardly needs to change .

In order to make React Native It's lighter and more adaptable to existing native applications , This reconstruction is mainly carried out from three aspects .

First , Changing the thread model .UI Updates no longer need to be executed on three different threads , It can be called synchronously on any thread JavaScript Make priority updates , At the same time, push low priority work out of the main thread , In order to keep right UI Response .

secondly , Introduce asynchronous rendering into React Native in , Allows multiple rendering and simplifies asynchronous data processing .

Last , Simplify bridging , Make it faster 、 A lightweight . Native and JavaScript The direct call between is more efficient , And it's easier to build debugging tools , Such as cross language stack trace .

After finishing the above work , It's possible to bring closer integration . Now? , If not through complexity hack There's no way for native navigation and gesture processing or native components ( Such as UICollectionView and RecyclerView) Working together . After making changes to the threading model , You can build this function directly .

Sophie Alpert The final say , Their goal is to hope React Native stay JavaScript The end can be lighter , To better adapt to JavaScript The ecological system . When the project is about to be completed ,Facebook More details will be revealed , Coming soon .

Airbnb give up RN, Return to the original

Airbnb Express , Although many teams rely on React Native And plan to use it in the foreseeable future , But they couldn't achieve their original goal in the end . Besides , There are also technical and organizational challenges that they cannot overcome , If you continue to use React Native, These challenges will eventually become bigger problems . therefore ,Airbnb To renounce the use of React Native, And put all the effort back into development based on native technology App.

Airbnb Abandon use React Native The main reason is React Native Failed to achieve full cross platform abstraction , Sometimes you still need to write code for a specific platform to solve the problem .

Earlier , Baidu has reported that it has stopped working internally React Native, change to the use of sth. Vue Or self-developed San News of the frame .

Google Release Flutter Release Preview 1

6 month 21 Japan , In Beijing, GMTC At the big front end Conference ,Google Flutter Senior engineer Yu Xiao announced that Flutter Release Preview 1 Release , And announced with Alibaba leisure fish team in Flutter On cooperation , It marks the Flutter Entering a new stage .

 Flutter Has been improving

stay Google I/O At the conference ,Flutter The team and a lot of Flutter We've been communicating with our developers , Also on Flutter Improved . After that ,Flutter The ecological environment has been growing rapidly ,Flutter The number of active users has increased 50%, More Than This , stay I/O In the weeks after the conference , Worldwide , Already exceeded 150 One and Flutter Related events happen .



Flutter The team says ,Flutter from beta Version up to now Release Preview 1, Both reflect their confidence and concern for stability and quality .

Flutter The preview gets a lot of support from the community , Contributions from outside include Flutter For hardware keyboards and bar code scanners 、 video recording 、 Image support . Besides , There are also many new packages for Flutter The contribution of the package site , for example Flutter Platform Widgets, A set of adaptive iOS or Android The widget of ; mlkit,Firebase MLKit API The wrapper class (wrapper); Sequence animation (Sequence Animation).

In the process ,Flutter The team shifted the focus to the integrity of the scene (scenario completeness). They're constantly improving the video player Suite , Provide wider format support and improve reliability . And it further expands on Firebase Support for , Such as Firebase Dynamic Links, This is an application solution for creating and handling links across multiple platforms . Now it has been extended to ARMv7 chip 、32 position iOS Device support , It makes use of Flutter The application written can still be used on old devices that are popular all over the world ( Such as iPad Mini and iPhone 5c) Up operation .

 Flutter In China,

Use Flutter The number of developers in China is second only to the United States and India , In China, , Many large companies have adopted Flutter, Alibaba has based them on Flutter Applications deployed on millions of devices , And Tencent is launching Flutter Of NOW Applications . at present , Chinese version of Flutter The website is online , You can visit !