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

288
Visualizações
How to display a text body with html tags, in React Native?

I have an api that returns some texts from a popular website in my country. You can think of these texts as user's comments. But these comments can includes links ( tag) and also like "< /hr />" tags. Some of them looks like this;

enter image description here

so basically I want an idea about how to manage these kind of texts when we want to display it in React Native?

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

Maybe this will answer your question:

const regex = /<[^>]*>/mgi
const text = "A text with <strong>html tags</strong>"
const text_without_tags = text.replace(regex, "")
// text_without_tags = 'A text with html tags'

The regular expresion gets every tags in a string (with their attributes). The method replace in this example will replace the tags that the regex got by "" (so nothing).

However, if you want to keep the tags, but only change them into JSX tags, use react-html-parser.

I'm not sure if I understood your goal.

about 4 years ago · Juan Pablo Isaza Relatório

0

You can use react-native-rich-editor to display the text if you want to keep the html tags

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