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

158
Visualizações
How to render a portion of html using webview in react native

I don't know if webview by react-native supports this functionality but can I pick and render a specific div and not the whole webpage

For example if a html site contains this segment:

<html>
  <head>
    <title>Href Attribute Example</title>
  </head>
  <body>
    <h1>Href Attribute Example</h1>
    <p>
      <a href="https://www.theExample.com">The example page</a> shows you how and where you can contribute to solutions.
    </p>
  </body>
</html>

But I only want to render this segment on the webview

    <h1>Href Attribute Example</h1>
    <p>
      <a href="https://www.theExample.com">The example page</a> shows you how and where you can contribute to solutions.
    </p>

How would I plug it in to be rendered here:

return(
<View>
 <WebView source={{ uri: 'https://www.theExample.com' }} />;
</View>
)
about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

Are you trying to achieve something like this: Render html using webview

Also have a look into this: React native custom html render

about 4 years ago · Juan Pablo Isaza Relatório

0

This functionality is not something you get out of the box. But there are some options definitely.

Here are the options I see if you control the source code of the page:

  1. Create a different entry point or build where unneeded content is stripped out. No dark magic at all, but might be problematic for big apps.
  2. Pass a query parameter that indicates that your app is in a web view mode(https://www.theExample.com?container=true). Then you check the presence of the query parameter in the app and show/hide what you need based on that condition.

Here are the options I see if don't you control the source code of the page:

  1. Execute JavaScript that removes from page everything you don't want to show by passing injectedJavaScript:
<WebView
  source={{ uri: 'https://www.theExample.com' }}
  injectedJavaScript="window.alert('You can manipulate the DOM here')"
/>
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