Levi Vaguez An enthusiastic writer and a reader who loves to explore new pastures. I began my journey as a Ruby on Rails developer but decided to pursue my love for writing even more.

What’s new in React Native 0.64

3 min read 912

React Native 064 Whats New

Since the release of React 17 in the fall of 2020, the developer community has placed high expectations on the next version of React Native. React Native 0.64 was released in March 2021 amid much fanfare and speculation. The new release brings some exciting new features that will benefit the entire community, especially iOS developers who have hotly anticipated the launch of Hermes on the platform.

In this guide, we’ll give you a peek at what’s new in React Native 0.64, including:

Hermes on iOS

Hermes is an open-source JavaScript engine that is optimized to run React Native on multiple platforms. Hermes improves app performance by decreasing memory utilization, reducing the download size of the app, and cutting down the time it takes to become usable, or time to interactive (TTI).

Hermes was previously available only to Android as an opt-in. With this update, Hermes is available on iOS as well.

As the React Native ecosystem has grown, developers have encountered challenges related to the production of large-scale apps. Huge bundle size, excessive phone memory usage, and increased interaction time, to name a few issues, can result in a bad user experience.

The engineers at Facebook designed Hermes as a lightweight solution to these problems. However, before the release of React Native 0.64, iOS developer faced an uphill battle when it came to maintaining the same level of quality.

The inclusion of Hermes on iOS helps React Native apps perform better, makes them more lightweight, and decreases interaction time on iOS platforms. This should incentivize the React Native community to contribute further toward the growth of Hermes and the platform in general.

Switching an existing project to Hermes

Before you switch an existing project to Hermes, you must ensure that you upgrade the project to use React Native 0.64. To enable Hermes on iOS, set hermes_enabled to true in your podfile and then run pod install.

It’s worth noting that support for Hermes is still is in its nascent form in iOS. We can expect further improvements and support in the days to come.

To enable Hermes on Android, add enableHermes: true to your android/app/build.gradle file.

Viewing Hermes traces with Chrome

Over the past year, Facebook has been sponsoring the Major League Hacking fellowship and supporting contributions to React Native, including the use of the Performance tab in Chrome DevTools to visualize the execution of a React Native application when it uses Hermes.

Though useful, this feature isn’t entirely new because you can already profile your React Native app running on Hermes. But by running this new command, you can convert a Hermes tracing profile to a Chrome tracing profile and pull it to the local machine:

react-native profile-hermes [destinationDir] <flag>

Learn more about how to record a Hermes sampling profile in the official docs.

Hermes with proxy support

React Native 0.64 also brings proxy support to Hermes. This support enables compatibility with the community’s popular projects, such as React Native Firebase and MobX. If you’ve been using these packages, you can now migrate your project to Hermes.

The React Native team is planning to make Hermes the default JavaScript engine for Android in an upcoming release. If you encounter an issue when using Hermes in your React Native projects, you should report it.

Inline requires enabled by default

Inline requires is a Metro configuration option that can help accelerate an app’s startup time by delaying the execution of JavaScript modules until they are used. Traditionally, the execution of JavaScript modules begins at startup.

This feature has existed for a few years as an opt-in configuration option, but React Native 0.64 has this option enabled by default to help you build fast-performing mobile apps without any extra configuration.

Inline requires is a Babel transform. It takes module imports and converts them to be inline.

Let’s look at an example in which inline requires transforms a module import call from being at the top of the file to where it is used.

Before:

import { TestFunction } from 'test-module';

const TestComponent = (props) => {
  const result = TestFunction();

  return <Text>{result}</Text>;
};

After:

const TestComponent = (props) => {
  const result = require('test-module').TestFunction();

  return <Text>{result}</Text>;
};

React 17

React 17 does not include any new feature or any big breaking developer-facing changes. The official blog post noted that React 17 is a “stepping stone” release designed to make it safer to embed a tree managed by one version of React inside a tree managed by another version. It also makes it easier to embed React into applications built with other frameworks.

In addition, a new JSX transform eliminates the need to import React to use JSX. This is an opt-in feature and the React team noted that it plans to continue support for the classic JSX transform.

Dependency changes

  • React Native has dropped support for Android API levels 16–20. As the Facebook app drops support for these Android versions, React Native will follow suit
  • Xcode 12 and CocoaPods 1.10 are now required
  • Minimum support for Node.js is bumped from version 10 to 12
  • Flipper bumped to 0.75.1

Conclusion

Thanks to the efforts of more than 100 contributors around the globe, React Native 0.64 is now live. This new release is beneficial to and supportive of the whole React Native community. With the community’s help to spot bugs, we can expect further improvements in upcoming releases.



LogRocket: Instantly recreate issues in your React Native apps.

LogRocket is a React Native monitoring solution that helps you reproduce issues instantly, prioritize bugs, and understand performance in your React Native apps.

LogRocket also helps you increase conversion rates and product usage by showing you exactly how users are interacting with your app. LogRocket's product analytics features surface the reasons why users don't complete a particular flow or don't adopt a new feature.

Start proactively monitoring your React Native apps — try LogRocket for free.

Levi Vaguez An enthusiastic writer and a reader who loves to explore new pastures. I began my journey as a Ruby on Rails developer but decided to pursue my love for writing even more.

Leave a Reply