Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

222
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda