react-native-expo-cached-image
react-native-expo-cached-image copied to clipboard
TypeError: null is not an object
Hi, great library!
One issue I found when switching from <ImageBackground> to <CachedImage> is that the latter doesn't play nice when source is null. This is the code I have:
<CachedImage
isBackground={true}
source={picture && { uri: `${API_URI}pictures/${picture}` }}
>
... content goes here
</CachedImage>
Would it be hard to make it skip loading an image and just act as a container when source is null? This is how <ImageBackground> behaves.
Just figured out I can do
source={{ uri: picture ? `${API_URI}pictures/${picture}` : undefined }}
And it will work. So my case is covered. Leaving this open for you to decide whether it's worth investing time into covering the case above. :slightly_smiling_face: