question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Warning: Failed prop type: Invalid prop `source` supplied to `Image`.

See original GitHub issue

Hi, this repo is really a great improvement for Expo Images. But this warning raised recently.

<CacheImage
        preview={getAvatarPlaceholder}
        uri={data.creator.photoURL}
        style={styles.userPic}/>

export const getAvatarPlaceholder = () => {
    return require('../assets/images/avatar-placeholder.png');
};


Warning: Failed prop type: Invalid prop `source` supplied to `Image`.
    in Image (at Image.js:92)
    in Image (at DiscoverScreen.js:347)

In output, it states that the error happens in Image.js:92 which is about preview.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

14reactions
brendan-jefferiscommented, Jan 4, 2019

If you’re passing a uri string, you’ll want to replace

preview={preview}

with

preview={{ uri: preview }}

Relevant PR here https://github.com/wcandillon/react-native-expo-image-cache/pull/102

0reactions
MarcosFF1996commented, Jul 14, 2020

If you’re passing a uri string, you’ll want to replace

preview={preview}

with

preview={{ uri: preview }}

Relevant PR here #102

It worked for me, thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

React-native failed propType on Image component
You should either require the local assets or use object with uri key. So either in MainComponent : this.state = { images:[ require('....
Read more >
invalid prop `rows` of type `object` supplied to `forwardref ...
Warning : Failed prop type: Invalid prop rows of type object supplied to ForwardRef(DataGrid), expected array.` Solution I believe the problem is in...
Read more >
[Solved]-React-Native Image Invalid prop 'source' supplied to ...
React error 'Failed propType: Invalid prop `children` supplied to `Provider`, expected a single ReactElement' · React-Native Image Invalid prop 'source' supplied ...
Read more >
React Native Community | [SOLVED] Solution is: <Image source
Everthing is working fine, but I've got a warning (both Android & iOS): "Failed prop type: Invalid prop 'source' supplied to Image".
Read more >
How to validate React props using PropTypes - LogRocket Blog
Learn how to validate props with React PropTypes, React's internal ... When an invalid value is passed for a prop, a warning is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found