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

218
Views
Best practice to import svg in React Native

I'm new to React native. I do the svg import as in the code below. But it doesn't looking well when it's too much. Is there a simpler way to do this?

import React from 'react';
import LeftArrow from '../../assets/svgs/left-arrow.svg'
import RightArrow from '../../assets/svgs/right-arrow.svg'
import HeaderLogo from '../../assets/svgs/header-logo.svg'
import NotificationOn from '../../assets/svgs/notification-on.svg'


export default function SignUp() {

  return (
    <>
      <LeftArrow
        width="100%"
        height="100%"
      />
      <RightArrow
        width="100%"
        height="100%"
      />
      <HeaderLogo
        width="100%"
        height="100%"
      />
      <NotificationOn
        width="100%"
        height="100%"
      />
    </>
  )
}

For example how can I use svg like this as I export and import images below

// src/assets/images/index.js
export const woman = require('./woman.png'); 
export const signUp = require('./signup-bg.png'); 


// src/screen/SignUp.js
import { woman, signUp } from '../../assets/images/index.js'

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

0

Look at react-native-svg but you'll need the SVG file contents instead of bringing it in like an image.

Quick example:

import Svg, {Path} from 'react-native-svg`

const LeftArrow = (props) => {
 return (
   <Svg width={48} height={48} viewbox="0 0 48 48" {..props}>
     <Path d="something" fill="#00000" />
   </Svg>
 )
}

export default LeftArrow

but you could template the the file and bring in what you need from each SVG.

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!