Source: Wikipedia
Starting with React Native 0.76, the new architecture (Fabric and TurboModules) is enabled by default, bringing significant improvements in performance, flexibility, and ease of development.
Here’s a quick update of what’s new in React Native 0.76:
- New Architecture Enabled by Default-
Fabric Renderer: The Fabric rendering engine is now the default, enabling faster and more efficient UI updates, better compatibility with concurrent rendering, and smoother animations.
TurboModules: By using TurboModules, the communication between JavaScript and native code is more efficient, reducing the overhead associated with the traditional bridge.
- New Features and Improvements
Hermes by Default: The Hermes JavaScript engine, which optimizes performance and memory usage, is the default JavaScript runtime. Hermes offers faster startup times and lower memory usage, especially on Android devices.
React Native 0.76 introduces two new style props— boxShadow and filter —specific to the new architecture, providing familiar styling options similar to the web.
boxShadow
Adds shadows to elements, controlling position, color, size, and blurriness.
Syntax: Takes a CSS-like string (e.g., '5 5 5 0 rgba(255, 0, 0, 0.5)') or a JS object with parameters (e.g., {offsetX: 5, offsetY: 5, blurRadius: 5, spreadDistance: 0, color: 'rgba(255, 0, 0, 0.5')}).
Improvements: Fixes previous shadow limitations on Android, supports inset shadows, and now works on views without background color.
Limitations:
- The default shadow color is black, not the parent’s color
- Android normal shadows are supported on Android 9+
- Android inset shadows are supported on Android 10+
filter
Adds filters for brightness, saturation, hue, and blurs to elements.
Syntax: Accepts a CSS-like string (e.g., 'saturate(0.5) grayscale(0.25)') or an array of JS objects (e.g., [{saturate: 0.5}, {grayscale: 0.25}]).
dropShadow differs from boxShadow by only casting shadows on pixels with nonzero alpha and lacks a spread distance.
Limitations:
- iOS supports only brightness and opacity, and no outside-the-bounds effects.
- Android blur and drop-shadow supported on Android 12+.
Improved Metro Bundler: Metro has been enhanced with faster startup and reload times, which helps speed up the development experience, especially in large projects.
Enhanced DevTools: The development tools are richer, with better React DevTools integration and improved error logging, making it easier to debug and understand performance issues.
New APIs and Module Improvements
Animated Layout Animations: Fabric enables enhanced support for layout animations, allowing more fluid and intuitive UI changes. With Fabric, you can now animate component mount and unmount with ease, improving user experience.Streamlined Native Module Setup
Native modules in 0.76 are easier to set up and integrate, especially with the new architecture in place. The updates reduce boilerplate and make it easier for modules to work seamlessly with both Fabric and TurboModules.React 18+ Integration
React Native 0.76 integrates React 18 features more deeply, especially around concurrent rendering, which improves responsiveness and smoothness. For instance, Fabric’s support for React 18's concurrent features helps manage rendering priorities better.Android Gradle Plugin 8 and JDK 17 Support
The default Android Gradle plugin has been upgraded to support AGP 8 and JDK 17, ensuring better compatibility with recent versions of Android Studio and offering improved build performance.
7.** Enhanced Accessibility Features**
Improved support for accessibility features like voice-over, TalkBack, and screen readers, enhancing the overall accessibility of React Native applications.
- Default TypeScript Setup New projects created with React Native 0.76 come with TypeScript configuration by default, reflecting the community’s growing preference for TypeScript.
Since the new architecture is enabled by default, you don’t need additional configuration to use Fabric and TurboModules in 0.76.
However, make sure you:
Update any third-party libraries to their latest versions, as they may need to be compatible with the new architecture.
Test your app thoroughly to ensure that Fabric and TurboModules don't cause unexpected issues, especially in parts of your app that heavily use native modules.
Migration Considerations
If you’re upgrading an older app, run react-native upgrade to manage the process. Check for any deprecated APIs or incompatible libraries, and consider migrating older custom native modules to the TurboModules format for better performance.
Example Project Creation in 0.76
To start a new React Native 0.76 project, run:
npx react-native@latest init your-app-name
With React Native 0.76, you’re set up with all these enhancements out-of-the-box, allowing you to build faster, more responsive, and modern applications right from the start.
Happy reading !!!!