Skip to content

experimental_backgroundImage: linear-gradient crash on update #8297

@fr0staman

Description

@fr0staman

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions