Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Images are not showing for me #13

Open
gfaraj opened this issue Sep 27, 2021 · 2 comments
Open

Images are not showing for me #13

gfaraj opened this issue Sep 27, 2021 · 2 comments

Comments

@gfaraj
Copy link

gfaraj commented Sep 27, 2021

Hi there, I'm trying this library but it's not working for me yet. Here's my webpack.config.js:

https://gist.github.com/gfaraj/7dd79873efeb4dac6776117b1cbd5165

When I build the web app, I see the images in the static/media folder but they don't get loaded. Here's an example:

            <View style={styles.pointsContainer}>
                <Image 
                    source={require('./img/tickerHeader.png')}
                    style={{width: wp(4), height: wp(4), resizeMode: 'contain'}} />
                <Text style={styles.points}>{user.points.toLocaleString(undefined, { maximumFractionDigits: 0 })}</Text>
            </View>

and the static/media folder contains the scaled images:

image

I see references to these files in the bundle file:

image

The web site doesn't seem to have any image tags or any of those image files referenced anywhere in the CSS. Any ideas?

@MorganTrudeau
Copy link

Try this configuration (adding esModule = false)...

{
  test: /\.(png|jpe?g|gif)$/,
  options: {
    name: 'static/media/[name].[hash:8].[ext]',
    esModule: false,
    scalings: { '@2x': 2, '@3x': 3 },
  },
  loader: 'react-native-web-image-loader',
};

@gentlee
Copy link

gentlee commented Aug 15, 2024

Also images are not shown, how to debug this package? what is name actually? Assets folder in my project is sources/assets/<lots of folders here>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants