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

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

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 Report

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 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!