SIGN IN SIGN UP
facebook / react-native UNCLAIMED

A framework for building native applications using React

0 0 151 C++

Add support for animated effects on spans of text (#56702)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56702

Adds `AnimatedEffectSpan`, a new span type for animated effects drawn on top
of text in `PreparedLayoutTextView`. Unlike `DrawCommandSpan` which provides
static `onPreDraw`/`onDraw` hooks, `AnimatedEffectSpan` supports animation via
a `requestAnimationFrame`-style API where the span receives a time delta each
frame and returns whether it wants another frame.

Key design decisions:
- Independent from `DrawCommandSpan` — does not subclass it
- Does not implement `UpdateAppearance` — animated effects don't affect text measurement or paint state
- Implements `ReactSpan` for integration with RN's span management
- Annotated `UnstableReactNativeAPI` — callers must opt in
- Zero overhead for non-animated text: delta computation and frame scheduling only happen when animated spans exist
- Frame timing resets on visibility changes and view recycling to prevent delta spikes

Changelog: [Internal]

Reviewed By: alanleedev

Differential Revision: D97399151

fbshipit-source-id: da2015c1b49d122c522dae5c49f6c83ca1979daf
A
Andrew Datsenko committed
71a0d5da1403f680ee3208fc834152ba3d080b4f
Parent: 97fa2a4
Committed by meta-codesync[bot] <215208954+meta-codesync[bot]@users.noreply.github.com> on 5/6/2026, 3:40:26 PM