N
N
Newbie Ivanovich2019-12-13 18:38:21
React Native
Newbie Ivanovich, 2019-12-13 18:38:21

Why is there an error in the react-native Image component?

put the image in the assets folder
saved the path to the variable image = '../../assets/wine1.png'
I pass this variable as props to the product component
there I try to display the image

<Image source={ require ( this.props.image )} style={styles.productImg} />

after that, the
require(image)
Failed building JavaScript bundle error occurs.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimka Reactive, 2019-12-13
@NovichokIvanovich

Import an image, don't create a variable
import image from '../../assets/wine1.png'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question