Skip to content

How to: animate a value

You want to animate a style prop (fade, slide, scale, a collapsing header) without reaching for a third-party animation library.

Every adapter — the same Animated namespace

Section titled “Every adapter — the same Animated namespace”
import { Animated } from '@symbiote-native/react'; // or '@symbiote-native/vue' / '@symbiote-native/angular' / '@symbiote-native/svelte' / '@symbiote-native/solid'
const opacity = new Animated.Value(0);
Animated.timing(opacity, {
toValue: 1,
duration: 300,
useNativeDriver: true,
}).start();

An AnimatedNode written into any style prop of any host tag resolves directly in the engine — the value publishes, subscribes, and gets pushed through a targeted native commit every frame, no wrapper required:

<view style={{ opacity }} />

Animated.View/Animated.Text/Animated.Image still exist, as thin convenience aliases over the tags — the dotted form works as written:

<Animated.View style={{ opacity }}>
<Animated.Text>faded</Animated.Text>
</Animated.View>

There is no Animated.ScrollView any more — style <scroll-view> directly, the same as any other tag: <scroll-view style={{ opacity }} onScroll={Animated.event(...)} />.

See the Animations guide for the rest of the surface (ValueXY, tracking, diffClamp, Animated.event).

  • useNativeDriver: true — for opacity/transform only. Runs entirely on the native side once started; the JS thread can stay busy without stalling the animation.
  • useNativeDriver: false (default) — for any other style property. Runs in JS, committing a new value through the engine every frame.
  • Animated.timing(value, { toValue, duration, easing }) — a fixed-duration curve.
  • Animated.spring(value, { toValue, ...physics }) — physics-based, and toValue can itself be another Animated.Value to chase a moving target.
  • Animated.decay(value, { velocity, deceleration }) — momentum-style deceleration.

Compose several with Animated.parallel([...]), Animated.sequence([...]), Animated.stagger(ms, [...]), or Animated.loop(animation).

For the full working reference — JS driver vs native driver side by side, a PanResponder-driven drag box, a tracking spring, and a diffClamp collapsing header — see AnimatedDemo/AnimatedParityDemo in examples/react/App.tsx.