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

558
Views
¿Cómo mostrar html local en React Native WebView sin react-native-static-server o similar?

En el proyecto React Native, tengo un documento html en el directorio src. (Suponiendo que se llame "./src/green.html").

Y en MyScreen, tengo un WebView para mostrar esta página.

 import WebView from 'react-native-webview'; import { Text, View, StyleSheet, Image } from 'react-native'; export default MyScreen (props) { const source = require('./green.html'); const webviewSOurce = Image.resolveAssetSource(source); return ( <View style> <WebView source={webSource} originWhitelist={["*"]} style={{ width:'100%', minHeight:400 }}/> </View> ) }

Pero muestra el contenido del archivo html como texto sin formato, no html.

 <div id="main-div"> <h1>Hello World! I am alive!</h1> </div>

Visité https://github.com/react-native-webview/react-native-webview/blob/master/docs/Guide.md#loading-local-html-files , pero no puedo obtener una imagen clara y react-native-http-server causa algunos problemas en mi aplicación.

¿Cómo puedo tratarlo? ¿Hay alguna forma alternativa de mostrar la página html local en WebView sin reaccionar-native-static-server o react-native-http-server?

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

0

Soy bastante malo reaccionando, pero me topé con esto hace un par de días tratando de hacer lo mismo. Es un poco largo, así que solo pondré la url. https://aboutreact.com/load-local-html-file-url-using-react-native-webview/

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!