Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

121
Vistas
Source Image React Native

I want to ask ask you all. I want to display image from local asset but for filename from object response api. I have tried some code but can't work. Do you everyone help me? below is some code that I have tried. I also added image to mylocal and my object response api already the same name with extension

<Image
   source={`../../../asset/images/Topup/${props.image}`}
   style={styles.GridImage}
   resizeMode="contain"
/>
<Image
   source={'../../../asset/images/Topup/' + ${props.image}}
   style={styles.GridImage}
   resizeMode="contain"
/>
<Image
   source={require(`../../../asset/images/Topup/${props.image}`)}
   style={styles.GridImage}
   resizeMode="contain"
/>
<Image
   source={require('../../../asset/images/Topup/' + ${props.image})}
   style={styles.GridImage}
   resizeMode="contain"
/>
about 4 years ago · Juan Pablo Isaza
3 Respuestas
Responde la pregunta

0

pass image as prop like this
props.image will equal require('fullpath/to/image-without-variables')
use it like this
<Image source={props.image} .../>

about 4 years ago · Juan Pablo Isaza Denunciar

0

You cannot use variables when requiring an image. The argument passed to require must be a string literal. Try require('../../../asset/images/Topup/image_name.extension').

about 4 years ago · Juan Pablo Isaza Denunciar

0

Try to copy the path of the image and paste it

or

you can import the image to the value after that write the value in the source

import value from 'path your image';


<Image
   source={value}
   style={styles.GridImage}
   resizeMode="contain"
/>
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda