Skip to content

returnType of mixColor is broken in 3.4.2 version #509

@YOEL311

Description

@YOEL311

mixColor returnType broken in react-native-reanimated "3.4.2"

  const sharedAnimation = useSharedValue(1);

 const backgroundColorAnimStyle = useAnimatedStyle(() => {
    return {
      backgroundColor: mixColor(sharedAnimation.value, '#00001', '#12345'),
    };
  }, []);
      <Animated.View style={backgroundColorAnimStyle} />
Type '{ backgroundColor: AnimatedColor; }' is not assignable to type 'StyleProp<AnimateStyle<MaybeSharedValue<StyleProp<ViewStyle>>>>'.
  Type '{ backgroundColor: AnimatedColor; }' is not assignable to type 'AnimateStyle<MaybeSharedValue<ViewStyle>>'.
    Types of property 'backgroundColor' are incompatible.
      Type 'AnimatedColor' is not assignable to type 'ColorValue | SharedValue<AnimatableValue> | Readonly<SharedValue<string>> | undefined'.
        Type 'number' is not assignable to type 'ColorValue | SharedValue<AnimatableValue> | Readonly<SharedValue<string>> | undefined'.ts(2322)
helperTypes.d.ts(32, 5): The expected type comes from property 'style' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<Component<AnimateProps<ViewProps>, any, any>> & Readonly<...>'

repo to reproducece bug
https://github.com/YOEL311/bugReanimatedRecovery

on redas branch

https://github.com/YOEL311/bugReanimatedRecovery/tree/redas

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions