0

My local images have suddenly stopped displaying in my app.

I tried the solution proposed here: https://stackoverflow.com/questions/35354998/react-native-ios-app-not-showing-static-assets-images-after-deploying but it didn't work.

This is the structure of my app

I'm importing my image as follows:

import image from '../../assets/images/home-1.jpg';
...
return (
      <SafeAreaView style={[styles.container, {margin: 0}]}>
        <Image source={image} style={styles.image} />
        ...
      </SafeAreaView>
    );
...
const styles = StyleSheet.create({
image: {
    backgroundColor: 'red',
    width: 300,
    height: 300,
  },
...

But my image looks like this: enter image description here

What can be wrong?

1 Answers1

0

I think your used is wrong. You can try:

 <Image source={require('./my-icon.png')} />

More in docs of React-native. Please follow it.

meowww
  • 138
  • 7
  • Nope, I tried using `const image = require('../../assets/images/home-1.jpg');` but it still doesn't work. The weird thing is that it used to work. – Esteban Kramer Sep 08 '20 at 13:59