I think this is a very annoying bug and feels like there is no solution but I want to share and ask.. I fetch data from server and I get image source from there and I use sa
As the React Native Documentation says, all your images sources needs to be loaded before compiling your bundle.
Adding a simple image in React Native should be like this:
Let's say you have this:
const slides = {
car: './car.png',
phone: '../phone.png',
}
Then you pass slides
as a parameter but still, you won't be able to use it like this (even though logically should work):
Use require()
inside the sildes{}
const slides = {
car: require('./car.png'),
phone: require('../phone.png'),
}
And the use it like this: