Facing Warning: Failed prop type: Invalid prop `source` supplied to `Image`. when running jest testcase in react-native (expo)

Viewed 134

Below is the code for error: Warning: Failed prop type: Invalid prop 'source' supplied to 'Image'.

const ParentComponent = () => {
 return (
  <Image source={require('app/assets/image.png')}/>
 );
}

I've defined name config in package.json as app

I'm receiving this error when I'm running a jest test.

1 Answers

You need to provide relative path to the photo, something like:

  <Image source={require('../../assets/image.png')}/>

(Depends on the file location)

Related