Skip to content

Unistyles 3.0 reaches stable with C++ core and selective updates

updated

Unistyles 3.0 has been released as stable after a year of design and development. The styling library moves StyleSheets and styles into C++, is tightly integrated with the Fabric renderer and does not support the old architecture. According to the announcement, it is the only styling library that relies on native code and C++ to do its work.

The author credits several contributors, including @mrousavy for react-native-nitro-modules, @brentlok for the web compiler and website redesign, @tomekzaw for validating the idea, @bartlomiejbloniarz for tips on Fabric's quirks and @piaskowyk for help with the Reanimated integration.

Selective updates

The author names selective updates as the best feature of the release. Unistyles 3.0 reads a StyleSheet, its styles and their dependencies to build a full representation on the C++ side, tracking which style depends on which value and which components use each style. The Babel plugin can track up to 16 dependencies, among them the theme, breakpoints, variants, color scheme, insets and font scale.

When a style references the theme or rt object, that link is stored. On any event, Unistyles recomputes and updates only the affected styles and components, without a re-render. The official guide "Look under the hook - how Unistyles works?" explains how it works, and the author's talk at the React Native Connection conference in Paris is also available.

New features

Highlights listed in the post:

  • New API that follows the React Native StyleSheet API
  • Compound variants
  • Scoped themes
  • Custom web parser, web only styles, CSS pseudo classes, classNames and more
  • Avoiding the keyboard with a new IME inset
  • Deep Reanimated integration
  • New mini runtime getters
  • Custom web with no React Native Web dependency

Tutorial

A hands-on tutorial covering almost every feature is available for those coming from Unistyles 2.0. It builds a music-player app with Expo Router, Reanimated and Unistyles, and takes about one hour.

Sunsetting Unistyles 2.0

The 2.x branch received 17 releases over the past year. Going forward, maintenance will be limited to critical patches and compatibility updates for new React Native and Expo versions. Support ends on 31 December 2025, or alternatively once the last compatible versions, React Native 0.84 and Expo SDK 55, are reached.

What's next

Over the next few weeks, feature development will pause to focus on tests, documentation, repository structure, and user support and bug fixes. Work on new features is planned to resume after summer.

Video

Source: www.reactnativecrossroads.com