react-native-reanimated icon indicating copy to clipboard operation
react-native-reanimated copied to clipboard

`experimental_backgroundImage: linear-gradient` crash on update

Open fr0staman opened this issue 3 months ago • 5 comments

Description

When you updating linear-gradient values - Android app crash with error:

Image

minimal repro:

const timer = useSharedValue(0);

useEffect(() => {
  timer.value = withRepeat(withTiming(1, { duration: 1000 }), -1, true);
}, []);

const backgroundStyle = useAnimatedStyle(() => {
  const topColor = interpolateColor(timer.value, [0, 1], ['#000', '#FFF']);
  const bottomColor = interpolateColor(timer.value, [1, 0], ['#000', '#FFF']);

  return {
    experimental_backgroundImage: `linear-gradient(to bottom, ${topColor}, ${bottomColor})`,
  };
});

I see #7929 not done and not merged, maybe that need slight attention?

Steps to reproduce

  1. Render Animated.View with experimental_backgroundImage: "linear-gradient" with updating

Snack or a link to a repository

TODO

Reanimated version

4.1.2

Worklets version

0.6.0

React Native version

0.81.4

Platforms

Android

JavaScript runtime

Hermes

Workflow

React Native CLI

Architecture

New Architecture (Fabric renderer)

Build type

Debug app & dev bundle

Device

Android emulator

Host machine

macOS

Device model

No response

Acknowledgements

Yes

fr0staman avatar Sep 25 '25 09:09 fr0staman

Hey! 👋

The issue doesn't seem to contain a minimal reproduction.

Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?

github-actions[bot] avatar Sep 25 '25 09:09 github-actions[bot]

As far as I know, we haven't added support for this property yet, so it gets sent to the native side as an unparsed string. We should add support for this prop but it is quite complex so it might take some time to implement it right.

MatiPl01 avatar Sep 25 '25 12:09 MatiPl01

+1

Yurii-Lutsyk avatar Oct 20 '25 07:10 Yurii-Lutsyk

@fr0staman Have u found any workarounds?

Yurii-Lutsyk avatar Oct 20 '25 08:10 Yurii-Lutsyk

+1

sakura-he avatar Nov 05 '25 16:11 sakura-he