Skip to content

Reanimated 3.0 is stable, with experimental shared element transitions

updated

The Reanimated team has published a stable release of Reanimated 3. The release brings new features, rewritten internals, and debugging improvements, while keeping the public API compatible with version 2.

Shared Element Transitions (experimental)

The long-awaited addition is Shared Element Transitions, which animate views between navigation screens. To use it, developers give animated views on two different screens the same sharedTransitionTag attribute; when navigating between those screens, the view moves smoothly from one position to the other.

The team has labeled the feature experimental. It is the first release of Shared Element Transitions, and the team is asking for feedback to help smooth out rough edges. Documentation and code samples are available on the Reanimated documentation website.

Rewritten core

Although Reanimated 3 looks similar to its predecessor on the surface, its core has changed significantly. The worklets/shared values engine and the layout animations engine were both completely rewritten, with the main goals of improving performance, memory usage, and stability.

The rewrites also enable new capabilities. Shared Element Transitions is built on top of the Layout Animations API and, according to the authors, depends on the new engine. The worklets and shared values rewrite also unlocks new possibilities, but that work is not yet fully finalized, and further updates are expected.

Developer experience

Several changes target debugging and everyday use:

  • Support for React Native's LogBox, giving better error reporting when something goes wrong inside worklets.
  • The JS debugger can now connect to the UI runtime and inspect the code executing there.
  • A number of patches aimed at helping developers work through common errors.

Reanimated 3 also introduces an "inline styles API". When shared values map directly onto a component's styles or properties, developers can skip the useAnimatedStyle hook and reduce boilerplate. The feature is optional: useAnimatedStyle continues to work, and animated styles can be mixed with the new inline syntax.

Upgrading

Reanimated 3 supports the New Architecture (Fabric), which is a key reason the team is encouraging users to move to it. To keep migration simple, there are no API-level changes compared with version 2. The one exception is that the deprecated API from Reanimated 1 has been removed. According to the team, this means most users should be able to upgrade without changing any code in their React Native projects.

For projects that still rely on the Reanimated 1 API, that code will need to be migrated before upgrading. Others can move to version 3 to gain Fabric compatibility and the performance and stability work in the rewritten engines.

The release was developed in partnership with Shopify, which has supported the project since work on Reanimated 2 began.

Source: swmansion.com