When I try to put an image like this, I get this error, does anyone know how to fix it? I've been trying to do the same thing with React and can't solve it for hours. It happens for SVGs and PNGs.
Asked
Active
Viewed 48 times
1
-
Welcome to Stack Overflow! [Please do not upload images of code/data/errors](//meta.stackoverflow.com/q/285551). – Wing Aug 07 '23 at 12:21
-
Here is a related question that solves the problem. https://stackoverflow.com/questions/33907218/react-native-use-variable-for-image-file – Mansur Aug 07 '23 at 12:28
-
I also found a good workaround I will be careful, thanks! – 신지훈 Aug 08 '23 at 00:25
1 Answers
2
You are having this problem because you cannot give dynamic paths for static assets in React Native. But you can map it from a list if you push all your objects inside one list with require('...) properties.
This should give you more in-depth information about how you can make it possible.
How can I show dynamic images with require() in React Native?

Enes İlhan
- 36
- 3