Search code examples
react-nativeexpo

Images not getting rendered in Image expo-image component


I am trying to render images from our backend in a react-native app using the expo-image Image component (I tried with the react-native Image component too and still failed) and for some reason that I cannot understand images that I get from the backend are not getting rendered.

I have tried random images from the internet and they are rendered just fine. I also made sure that the uri of the images is correct and also tested the same uri's in postman and it works there. I am really struggling to find a reason for this. This is how one of the Image components looks like:

 <Image
                source={{
                    uri: "https://[dev.server.com]/img/ec/LEXUS-NX-226-400x400.jpg",
                }}
                style={{
                    width: "100%",
                    height: 200,
                    borderRadius: 8,
                    flex: 1,
                }}
            />

Solution

  • The problem I had was that expo-image requires you to import image the link using require if you want to get it from your file system