React-native: Color Interpolation for borderColor causes InvalidProp error

Created on 20 Jun 2016  ·  1Comment  ·  Source: facebook/react-native

I have a circle view in which I want to animate the color of the border using a Animated.Value that changes between 0 and 1. Following the guide from https://facebook.github.io/react-native/docs/animated.html I ended up using the interpolate function in Animated.Value.

     borderColor: this.state.active.interpolate({
        inputRange: [0, 1],
        outputRange: ['rgba(0, 0, 0, 0)', 'rgba(0, 0, 0, 1)']
      })

This creates a warning in the app (Android):

index.android.bundle:29278Warning: Failed propType: Invalid prop `borderColor` supplied to `View`: [object Object]
Valid color formats are
  - '#f0f' (#rgb)
  - '#f0fc' (#rgba)
  - '#ff00ff' (#rrggbb)
  - '#ff00ff00' (#rrggbbaa)
  - 'rgb(255, 255, 255)'
  - 'rgba(255, 255, 255, 1.0)'
  - 'hsl(360, 100%, 100%)'
  - 'hsla(360, 100%, 100%, 1.0)'
  - 'transparent'
  - 'red'
  - 0xff00ff00 (0xrrggbbaa)

Bad object: {
  "borderWidth": 2,
  "justifyContent": "center",
  "alignItems": "center",
  "width": 200,
  "height": 200,
  "borderRadius": 100,
  "borderColor": "rgba(0, 0, 0, 0)"
} Check the render method of `Circle`.

From the warning above, it seems like borderColor is correct. However, it still gave the warning.

Locked

Most helpful comment

Fixed it by using <Animated.View> instead of <View>

>All comments

Fixed it by using <Animated.View> instead of <View>

Was this page helpful?
0 / 5 - 0 ratings

Related issues

anchetaWern picture anchetaWern  ·  3Comments

jlongster picture jlongster  ·  3Comments

aniss picture aniss  ·  3Comments

despairblue picture despairblue  ·  3Comments

WG-Com picture WG-Com  ·  3Comments