Image does not appear React-Active

Asked

Viewed 104 times

-1

I’m starting in React-On, so I was making an App watching a video, and when I went to put an image it didn’t appear, I put it inside a folder, and when I put the image path doesn’t appear anything. I’ve tried everything, but I did exactly what the video guy did. Video link: https://www.youtube.com/watch?v=ZSV4fsaVTIs&t=2101s

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



export default function App() {
  return (
    <View style={styles.container}>
      <Image source={require('./src/assets/logo.png')}/>
      <Text>ADSASDAaS</Text>
    </View>
  )
}



const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
    backgroundColor: '#f3f3ff'
  }
});

inserir a descrição da imagem aqui

inserir a descrição da imagem aqui

1 answer

-2

Good morning. Do the following:
adds to Imports

import logo from './src/Assets/logo.png';

then pass in your image:
< Image source={logo} />

I hope I’ve helped. I’m available.

  • I tried but it didn’t work either, but I was able to put an image using Uri and an internet link. Mt strange, I will investigate further to try to find out why I can not put a local image.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.