React Native, Facebook’s framework for building native mobile apps, is to be rearchitected for flexibility and mproved integration with native infrastructure.
The framework, which uses JavaScript and the React UI library, will get a rewrite of many of its internals. Most changes, however, will be under the hood, with existing React Native apps continuing to work with few or no changes.
Rearchitecting the framework to be more lightweight and better fit into existing native apps involves three major internal changes:
- A change to the threading model. It will be possible to call synchronously into JavaScript on any thread for high-priority updates while keeping low-priority work off the main thread.
- Addition of async rendering capabilities to allow multiple rendering priorities and simplify asynchronous data handling.
- Bridge simplification to make it faster and lightweight. Direct calls between native and JavaScript are more efficient and it will be easier to build debugging tools such as cross-language stack traces.
Facebook said that closer integrations will be straightforward after these changes. Currently, it is not possible to incorporate native navigation and gesture-handling for native components such as UICollectionView and RecyclerView, unless complex hacks are used.
Facebook also expressed intentions to slim down React Native to make it better fit with the JavaScript ecosystem. This includes making the VM and bundler swappable.
Facebook noted that initial principles of React Native have made it harder to build some features. These include having a single, asynchronous “bridge” between JavaScript and native development, which has prevented integration between JavaScript logic directly with many native APIs. A batched bridge for queuing native calls means it is harder to have React Native apps call into functions implemented natively. Also, a serializable bridge means there is unnecessary copying instead of direct memory-sharing.
Where to download React Native
You can download React Native from its GitHub repo.