2

While running jest I am getting this strange warning stating

console.error node_modules/fbjs/lib/warning.js:33
Warning: Failed prop type: Invalid prop `opacity` of type `object` supplied to `Image`, expected `number`.
Bad object: {
  "position": "absolute",
  "top": 40,
  "right": 24,
  "opacity": {
    "_children": [],
    "_value": 0.5,
    "_startingValue": 0.5,
    "_offset": 0,
    "_animation": null,
    "_listeners": {}
  }
}
    in Image

and my actaul component code is the following

<Animated.Image
    source={require('../loginUserPicture.png')}
    style={[
       styles.loginUserPicture,
       {
           opacity: animatedOpacity,
           transform: [{
               scale: animateUserIcon
           }]
        }
    ]}
/>

Could anyone help me in getting rid of this warning. From the waning message I can see that the test framework is not recognizing the Animated value.

It is not mentioned anywhere in the documentation and seems like no one else is getting this warning. Please let me know if I am doing anything wrong.

skyboyer
  • 22,209
  • 7
  • 57
  • 64
Vinoth Kumar
  • 1,347
  • 1
  • 14
  • 23
  • 2
    To get a better answer please add your code of failing test and how you set `animatedOpacity`. – bennygenel Apr 09 '18 at 07:51
  • Hi thanks for your response. I am just rendering the app `renderer.create().toJSON();` Running with the default config and mocks. I could not find any proper guide on this topic. If we need to pass or mock Animated object please let me know how to do it. – Vinoth Kumar Apr 10 '18 at 03:09

0 Answers0