Itay209
Itay209

Reputation: 131

React native image "Unable to resolve module"

I'm trying to add a logo to my app, and I require the image from a folder inside the project's folder. I followed the docs, and it won't recognize my logo image, I even tried with a different folder and still nothing. "The module './logowo.png' could not be found" enter image description here

Any ideas? Thank you!

Upvotes: 2

Views: 5836

Answers (2)

Jeeva
Jeeva

Reputation: 1590

As by your error, "The module './logowo.png' could not be found". You might have mis spelled the name of your image instead of ./logwo.png. The path you have mentioned is fine. It works perfectly for me, when i try to mimic the error. You may use it like below,

import React, { Component } from 'react';
import { StyleSheet, Image, Text, View } from 'react-native';

export default class Logo extends Component{
  render(){
    return(
      <View style={styles.container}>
        <Image source={require('./logwo.png')} />
      </View>
    )
  }
}

Upvotes: 0

Calvin Tey
Calvin Tey

Reputation: 41

try importing the image first?

For example:

At line 9:

import imagename from './logwo.png'

and the image tag:

<Image source = { imagename } />

Upvotes: 1

Related Questions