Skip to content

Style property 'backgroundColor' is not supported by native animated module #14178

Closed
@mongris

Description

@mongris

Description

I am trying to animate backgroundColor with scrollView, but got

Style property 'backgroundColor' is not supported by native animated module

But accoding to the blog post it has be supported.

Not everything you can do with Animated is currently supported in Native Animated. The main limitation is that you can only animate non-layout properties, things like transform, opacity and backgroundColor will work but flexbox and position properties won't. Another one is with Animated.event, it will only work with direct events and not bubbling events. This means it does not work with PanResponder but does work with things like ScrollView#onScroll.

Please help me to figure out how to animate backgroundColor with useNativeDriver or is it still not support (the blog post is wrong)?

Reproduction Steps and Sample Code

Some code like:

const  _scrollPos = new Animated.Value(0);
const  _scrollSinkX = Animated.event(
    [{ nativeEvent: { contentOffset: { x: this._scrollPos } } }],
    { useNativeDriver: true });

<Animated.ScrollView
  onScrol={_scrollSinkX}
>
  {items}
</Animated.ScrollView>

const animatedStyle = _scrollPos.interpolate({
  inputRange: [0, 100],
  outputRange: ['rgba(255, 0, 0, 1)', 'rgba(0, 255, 0, 1)']
});

<Animated.View
  style={animatedStyle}
>{children}</Animated.View>

Solution

None

I were trying to simple add 'backgroundColor: true' to


but not working.

Additional Information

  • React Native version: 0.44
  • Platform: iOS
  • Development Operating System: macOS
  • Dev tools: XCode

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions