mcnamee/react-native-starter-kit

Image Path

DaBlitzStein opened this issue · 3 comments

The folder "images" is provided to contain images common on native and react.
Webpack files doesn't consider images inside.

Even if I include images inside webpack, the output path is related below "web" and it cannot use common image folder.

Help us reproduce - tell us about your environment

Standar git cloned repository

Steps to reproduce

Try to include an imagen on any file from the directory src/images in the web version.

Expected result

Image appears

Actual result

Image not found.

Try this:

npm install url-loader

and in web.pack config (dev and prod) add the following under module->loaders

{
test: /.(png|jpg)$/,
loader: 'url-loader'
},

Then in your file you can load those images as

img alt="" src={require("../../images/oslogo.png")}

even for me the same issue and resolved like this. It works fine for me.

let me know if that works

@brainahdev the solution is working. Thanks !