github jpudysz/react-native-unistyles v2.4.0
Release 2.4.0

latest releases: v2.12.0, v3.0.0-alpha.36, v3.0.0-alpha.35...
8 months ago

2.4.0 (2024-02-27)

Introducing the new version of Unistyles, and this one is significant!
Thank you for your patience, as it took me some time to complete it.

Built-in Safe Area Insets

This feature enables you to use insets values without the need for the react-native-safe-area-context package and passing any value to your stylesheet. Unistyles will automatically update your stylesheets with fresh values straight from C++!

You can access the new API with UnistylesRuntime:

const stylesheet = createStyleSheet(theme => ({
    header: {
         // will always be up-to-date
         paddingTop: UnistylesRuntime.insets.top
    }
}));

Insets expose 4 values: top, bottom, left, and right.

Status Bar and Navigation Bar

You can now also access some metadata about the status bar and navigation bar. Unistyles exposes their dimensions. They will always be up to date, and you can use them directly in the stylesheet with UnistylesRuntime:

UnistylesRuntime.statusBar.height // or width
UnistylesRuntime.navigationBar.width // or height

Content Size Category Improvements

The content size category is a user preference used to adjust the text size in your app. This feature is especially useful for users with visual impairments or limited vision. I've introduced new accessibility values for iOS: accessibilityMedium, accessibilityLarge, accessibilityExtraLarge, accessibilityExtraExtraLarge, accessibilityExtraExtraExtraLarge

Android has also received new values for very large fonts: extraHuge, extraExtraHuge.

You can access the Content Size Category with UnistylesRuntime:

UnistylesRuntime.contentSizeCategory

Redesigned Android Architecture

You can expect fewer re-renders and better performance. Unistyles is now smarter and can distinguish what has changed and emit only necessary events. This was not supported from the beginning, as Android has no dedicated events for orientation, dark mode, and content size category changes.

x64 Builds for Windows

Version 2.3.0 brought you support for react-native-windows. I was creating a bridge on my macOS computer with Parallels. I missed some configurations, and Unistyles wouldn’t compile on Windows computers. It’s now fixed, and you can develop cross-platform apps on your personal PC.

Fix for Rare Android Crash on Some Devices

That was tough to spot, as it happened rarely, but due to a race condition, Android reported some events faster than Unistyles was able to initialize. You can now enjoy a new bug-free version!

Docs Improvements

You can explore a new section about Dimensions and read some new guides. I marked the new content with a NEW badge.

Docs

Don't miss a new react-native-unistyles release

NewReleases is sending notifications on new releases.