react-native

Error on load image on React-native: Unexpected character


I'm try display a image on a component on React-native, but I don't know why this error happens...

Example of code:

render () {
    let { convenience } = this.props
    return (
      <View style={{flexDirection: 'row', height: 50}}>
        <Text style={{marginRight: 30}}>{convenience.name}</Text>
        <Image source={require('./icons___favorito_ativo.png')} />
      </View>
    )
}

Printscreen:

enter image description here


Solution

  • I too faced the same error. After a lot of trying, I restarted the packager, and the app picked up the image. So the solution is: Restart the packager.

    Hope this helps.