website/blog/2022-09-05-version-070.md
We are excited to release a new version of React Native, 0.70.0. This version comes with several improvements like a new unified configuration for Codegen, Hermes as default engine, and full CMake support for Android builds along with a refresh of the documentation for the New Architecture. Read on to learn more!
Over the last few months, we have been working to add more content to the New Architecture section of the documentation. In the new section you can find migration guides, examples and tutorials to get you up to speed.
Along with it, you can find new documents diving into Why a New Architecture and the various parts of it. We hope this helps you better understand the rationale behind the new APIs.
Any feedback is more than welcome, please let us know in the react-native-website repository.
React Native 0.70 is the first version with Hermes, our in-house JS engine, enabled by default.
This is the result of collaborative effort between the Hermes team and the React Native team, alongside with the priceless contributions from the community. We worked to improve and fine tune Hermes to make it more performant and deliver highly requested features by the community.
You can read more about it in the official announcement blogpost.
With 0.70, we introduced a unified way to define the Codegen specs for both iOS and Android. Previously, you had to put the Android configuration in a separate build.gradle file.
Now, you can define it directly in the package.json with:
"codegenConfig": {
"name": "CustomAnimationView",
"type": "components",
"jsSrcsDir": "./src",
"android": {
"javaPackageName": "com.custom.animation"
}
}
This improvement provides a more consistent experience for library maintainers in migrating their codebases to the New Architecture.
If you are a library maintainer, please make sure to let us know how the process is going for you in this discussion in the React Native New Architecture working group.
With 0.70, users on New Architecture are able to automatically link libraries without any additional configuration on their Android.mk or CMake files.
Autolinking is a crucial part of the React Native development experience. It allows you to include external libraries with a yarn add command, without dealing with CocoaPods or Gradle setups.
The New Architecture required us to adapt the auto-linking features to support libraries which are using the Codegen and exposing native code to app developers.
While Autolinking worked well for New Architecture libraries on iOS, the same was not true for Android. With 0.70 we closed this gap and you can now keep on including libraries with yarn add to your project: they will be linked correctly on any architecture.
Starting from 0.70, users can now use CMake to configure their Native builds. While we don’t expect app users to directly write C++ code, you still need an entry point for the native compilation.
From now on you can use a CMakeLists.txt file instead of an Android.mk file for anything Android/Native related in your project.
This change benefits both app and library users on the New Architecture as:
Android.mk and CMakeLists.txt, so libraries should not worry about doing anything if they're using the default setup we provide for New Architecture libraries.Android.mk or CMake files, the recommended solution in the future would be CMake files (due to better documentation, tooling and ecosystem around CMake).As mentioned above, some of the more important improvements in this release are centered around the New Architecture experience. However, there have been other notable changes, including:
mac_catalyst_enabled to true in Podfile (see upgrade-helper diff for details).reactnativeutilsjni as it is built from the same sources as reactnativejni which results in ~220 KBs saved from every Android APK build. (https://github.com/facebook/react-native/pull/34339).There have also been a few breaking changes:
Promise.prototype.done (018d5cf985 by @motiz88)Please also note that the version of Metro has been bumped to 0.72, which comes with 5 breaking changes.
And we upgraded some of our dependencies:
You can check out the full list of changes in the changelog.
88 contributors with their 493 commits have helped to make this release possible - thanks everyone! We are also thankful to everyone else who gave their feedback to ensure this release would be as stable as possible.