React Native Screens 4.0.0 adds sheet detents and preloading
Software Mansion has released version 4.0.0 of react-native-screens, a new major version of the library that is usually used indirectly through navigation libraries such as react-navigation or expo-router. The announcement, written by Kacper Kafara, describes several changes that may still affect app developers.
Sheets API
The release adds support for formSheet presentation on Android and custom detents on iOS, which the post calls the main highlight. Detents are set through the sheetAllowedDetents property of a screen.
On Android, up to three detents (snap points) can be specified, along with control over the sheet's corner radius, dimming view, initial detent, elevation and more. On iOS, an unlimited number of detents is supported, plus extra options such as sheetExpandsWhenScrolledToEdge and sheetLargestUndimmedDetentIndex, which govern how the sheet interacts with nested scroll views or the content beneath it. When the dimming view is present, interaction with underlying content is disabled.
The API is not standalone and is meant to be used with native-stack only. It also comes with temporary limitations due to implementation trade-offs, which are detailed in the release notes.
Preload support for native-stack screens
Screens can now be retained while detached from the HostTree, enabling preload support for native-stack v7, available through react-navigation. Preloading lets React Native render a screen and create its native views in advance, without showing (mounting) them until the user navigates there. The post notes this should help with screens that take a long time to load.
iOS animation improvements
The simple_push iOS animation has been aligned to closely match native defaults. This affects the stack animation itself as well as the completion animation after a gesture is cancelled during interactive swipes.
native-stack v5 dropped, react-navigation v7 supported
Version 4.0.0 supports react-navigation v7 and powers most available navigators, with a particular focus on native-stack v7. There are plans to reintroduce compatibility for native-stack v6. Support for native-stack v5 is being dropped: it has been marked as deprecated and is slated for removal in an upcoming minor version, though the code is still shipped for now. Users still on native-stack v5 are advised to stay on the 3.x line or migrate to react-navigation v7 and react-native-screens v4.
Other changes
The release includes smaller breaking changes, such as prop renaming, hiding raw native components from the public API, API updates for authors of navigation libraries and changed default values. According to the post, these were handled at the navigation library level and should not impact most users directly.
Version 4.0.0 also introduces support for react-native 0.76, includes numerous fixes improving new architecture support, and resolves longstanding issues such as long title truncation in the native-header component.
Links
Source: swmansion.com