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

249
Views
Cannot import images from a sibling directory - React Native

I have tried many ways to get out of this problem. I have a folder named Screens in which I have a file name HomeScreen.js

assets--
       |__ padlock.png
Screens--
        |__ HomeScreen.js

When I am trying to import padlock.png into HomeScreen.js it gives following error.

Unable to resolve module ./assets/padlock.png from D:\User\react\myproject\Screens\HomeScreen.js:

Following methods I have tried in HomeScreen.js

const imageLock = require("../assets/padlock.png"); //Not working
const imageLock = { uri: "../assets/padlock.png" }; //Not Working
import imageLock from "../assets/padlock.png"; //not working

I have make sure that padlock.png exist and I am not making any mistakes. Full error message is as below.

Unable to resolve module ./assets/padlock.png from D:\User\react\myproject\Screens\HomeScreen.js:

None of these files exist:

  • padlock.png
  • Screens\assets\padlock.png\index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json)
    27 | const imageLock = require("../assets/padlock.png"); | ^ 28 | 29 | export default function HomeScreen({ navigation }) { 30 | const [modalOpen, setModalOpen] = useState(false);

This is directory structure

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Did you try

    <Image
      style={{ width: 100, height: 100 }}
      source={require('../assets/padlock.png')}
    />
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!