Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

130
Views
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 answers
Answer question

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 Report

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!