WhoBuilt

The New React Native: Bringing the Fabric renderer to the “Facebook” app

Nov 8, 2021· 39 min· 4.2K views·Watch on YouTube

Speaker

Joshua Gross, an engineer on Facebook’s React Native core team, describes the Fabric renderer rewrite and its rollout across the Facebook app at React Native EU 2021, presented by Callstack.

Why React Native needed a new architecture

Gross says React Native had separate implementations for iOS, Android, Windows, and other platforms, which could behave differently. The team began a cross-platform rewrite in 2018 to support future features such as concurrent rendering while bringing the change to existing apps, starting with Facebook.

Migrating more than 1,000 surfaces

The Facebook app had more than 1,000 React Native surfaces, from smaller pages to complex products such as Marketplace, Dating, and Jobs. Because changes from React Native’s main branch reached users in weekly releases, the team had to watch stability, performance, and crashes across many devices and usage conditions. The migration took about two years to enable Fabric on the first surface, then another nine months to roll it out across the rest.

Finding and fixing hidden differences

The work uncovered undocumented features, optimizations, and differences between the Android and iOS implementations. The team documented and fixed many discrepancies, removed platform-specific code, and improved areas such as Android ScrollView and layout animations. Most surfaces worked with both renderers without code changes, but some deprecated APIs needed migration paths.

Debugging production-only failures

Gross recounts a crash that appeared only on certain Android devices: some manufacturers crashed when code removed a child from a parent that had no children. Fabric was made resilient to that operation and logs a console message when it occurs. In another case, a highly optimized screen stalled because its startup logic assumed a particular order of asynchronous lifecycle events; making the product code tolerate different orders improved both Fabric and the older renderer.

Preparing the architecture for wider use

By the time of the talk, the Facebook app was fully running on the new architecture, but Gross said broader adoption still needed tutorials, guides, and compatibility work on popular open-source packages. The team was working with Expo, Callstack, Software Mansion, and package maintainers, without committing to a release date.

Takeaways

  • At large scale, rare failures still affect many users; monitor production behavior, not just local reproductions.
  • Document which API behaviors are guaranteed, and make asynchronous state machines handle unexpected event orderings.
  • Use staged rollouts that can switch individual surfaces and user groups between implementations.
  • Migration work can expose platform drift and simplify code for both the new and existing implementations.
  • Plan ecosystem documentation and package compatibility as part of an architecture rollout.

Mentioned in this talk

Search inside this talk

What was claimed 9

  • uses
    “we've been testing the rollout of them within our own apps, including the flagship Facebook app.”
    YouTube
    Verified8 sources· Talk
  • role at
    Joshua Gross is engineer on the React Native core team at Meta
    “I'm an engineer on the React Native core team at Facebook.”
    YouTube
    Unverified1 source· Talk
  • feature
    Fabric: Cross-platform renderer designed to support concurrent rendering, better performance, and reliability
    “We wanted concurrent rendering, better performance and reliability.”
    YouTube
    Unverified1 source· Talk
  • metric
    Facebook app: Over 1,000 React Native surfaces
    “Altogether, there are over 1,000 surfaces in the Facebook app built with React Native.”
    YouTube
    Unverified1 source· Talk
  • metric
    Meta: More than 1 billion people visit Marketplace each month
    “More than 1 billion people globally visit Marketplace each month.”
    YouTube
    Unverified1 source· Talk
  • metric
    Dating: Over 1.5 billion matches created since launch
    “Since the launch of Dating, over 1.5 billion matches have been created.”
    YouTube
    Unverified1 source· Talk
  • uses
    “as of last month, React Native in the Facebook app is now completely powered by the new architecture.”
    YouTube
    Unverified1 source· Talk
  • uses
    “We modified our navigation system to support selectively turning the architecture on and off for individual surfaces.”
    YouTube
    Unverified1 source· Talk
  • feature
    Fabric: Supports layout animations equally well on Android and iOS
    “Now, they work equally well on both platforms with Fabric.”
    YouTube
    Unverified1 source· Talk

Related talks