Load html inside webview using react native

js webview html javascript react-native 4 years, 10 months ago
// html.js module.exports = function() { return ` <html> <head> <title>Page Title</title> </head> <body> <h1>My First Heading</h1> <p>My first paragraph.</p> </body> </html> `}; // LoadHTMLInWebView.js import React from 'react'; import {WebView} from 'react-native-webview'; export default class LoadHTMLInWebView extends React.Component{ render(){ return( <WebView style={{width: 300}} source={require('./html.js')()} //If both files are in the same level originWhitelist={['*']} /> ); } }
1530
Instructions

Install react-native-webview using npm
npm i react-native-webview --save
try to seperate the code into two files, try to run the react component.

Posted By
work with react without node installation in
//Basic way
<!DOCTYPE html>
<html>
javascript react js html
harika
Render custom components without node install
<!DOCTYPE html>
<html>
  <head>
react js html
harika
How to get first element of the list in Djang
<h3> Print all elements</h3>
<div>
    {% for item in my_list %}
html python django
kishore_kumar
Search options in bootstrap select , search s
<script src="https://ajax.googleapis.com
<script src="https://maxcdn.bootstrapcdn
<link href="https://maxcdn.bootstrapcdn.
html bootstrap
kishore_kumar
How to iterate json object in angular js
<html>
    <body>
        <table data-ng-repeat="(key, val
html json angular js
harika
How to get key value pairs of json object in
<html>
    <body>
        <table data-ng-repeat="(key, val
html json angular js
harika
template filters for slice string and print n
<!-- will give first 100 characters from
{{ my_string | slice:"100 "}}

html python django
kishore_kumar
for loop counter in python Django template
{% for my_object in my_object_list %}
    {{ forloop.counter }} {# starting in
    {{ forloop.counter0 }} {# starting i
python django html
kishore_kumar
Load native javascript inside webview in reac
import React, { Component } from 'react'
import {View,  WebView} from 'react-nati

html react-native webview javascript js
harika
Work with inline styles in React js
//plugin to any test js file and proceed
//This is the best standard to work with
const style = {background:'cyan', color:
javascript react js css
harika
Work with 3rd party css libraries in react fr
import React from 'react'
//No need to give the complete path, rea
//If not exists searches globally
javascript react js
harika
Difference between state and stateless compon
//State Component
<!DOCTYPE html>
<html>
javascript react js
harika
Create a React app without webpack and Create
//Basic way
<!DOCTYPE html>
<html>
javascript react js webpack
harika
JQuery toggle functionality in react
import React from 'react'
export default class ToggleComponent ext
  constructor(props){
javascript react js
harika
display state inside any html tag
import React from 'react'
export default class StateProps extends 

javascript react js
harika
Import any class irrespective of default expo
import React, { Component } from 'react'
javascript react js
harika
Run Java script code Synchronously inside a f
async function showAvatar() {

  // read our JSON
javascript
harika
Run shell files in javascript
//JS Code
function runShellScript(){
    const process = require('child_proce
javascript shell node js
harika
XHR Request & Ajax Request
//Fill
javascript
harika
Pass Data/Properties from child to parent in
//Parent.js
import React from "react";
import Child from './Child'
javascript react js
harika