React Native & iframe & WebView

React Native 怎么渲染 iframe 页面

WebView & source html

https://facebook.github.io/react-native/docs/webview#source

https://facebook.github.io/react-native/docs/webview.html#html

// old

import { WebView } from "react-native";

https://github.com/react-native-community/react-native-webview

# install
$ yarn add react-native-webview # link
$ react-native link react-native-webview
// new 

import { WebView } from "react-native-webview";

WebView

https://reactscript.com/tag/iframe/

http://www.hangge.com/blog/cache/detail_1564.html


/**
*
* @author xgqfrms
* @license MIT
* @copyright xgqfrms
*
* @description WebViewIframe
* @augments
* @example
*
*/ import React, {Component} from "react";
import {
StyleSheet,
Dimensions,
Text,
View,
WebView
} from "react-native"; // 获取设备的宽度和高度
let {
height: deviceHeight,
width: deviceWidth
} = Dimensions.get("window"); class WebViewIframe extends Component {
render() {
return (
<View style={styles.container}>
<WebView bounces={false}
scalesPageToFit={true}
source={{
uri:"https://cdn.xgqfrms.xyz",
method: "GET",
}}
style={{
width:deviceWidth,
height:deviceHeight,
}}>
</WebView>
</View>
);
}
} // css-in-js
const styles = StyleSheet.create({
container: {
flex: 1,
paddingTop:20
}
}); export default WebViewIframe; export {
WebViewIframe,
};

new version


/**
*
* @author xgqfrms
* @license MIT
* @copyright xgqfrms
*
* @description WebViewIframe
* @augments
* @example
*
*/ import React, {Component} from "react";
import {
StyleSheet,
Dimensions,
Text,
View,
WebView
} from "react-native"; // 获取设备的宽度和高度
let {
height: deviceHeight,
width: deviceWidth
} = Dimensions.get("window"); class WebViewIframe extends Component {
render() {
return (
<View style={styles.container}>
{/* <WebView
bounces={false}
scalesPageToFit={true}
source={{
uri:"https://cdn.xgqfrms.xyz",
method: "GET",
}}
style={{
width: deviceWidth,
height: deviceHeight,
}}>
</WebView> */}
{/* <WebView
bounces={false}
scalesPageToFit={true}
source={{
html: `
<h1 style="color: #0f0;">
WebView & Iframe
</h1>
`,
}}
style={{
width: "100%",
height: 30,
}}>
</WebView> */}
<WebView
bounces={false}
scalesPageToFit={true}
source={{
html: `
<iframe
name="iframeWindow"
src="https://cdn.xgqfrms.xyz"
width="100%"
height="300"
data-dom="iframe"
target="_self"
about:blank
style="border: 1px solid red;"
>
</iframe>
`,
}}
style={{
width: "100%",
height: 300,
}}>
</WebView>
</View>
);
}
} // css-in-js
const styles = StyleSheet.create({
container: {
flex: 1,
paddingTop:20
}
}); export default WebViewIframe; export {
WebViewIframe,
};

https://github.com/archriss/react-native-render-html

https://stackoverflow.com/questions/53736424/how-to-render-html-table-in-react-native

Render HTML in React Native

https://stackoverflow.com/questions/29334984/render-html-in-react-native

React Native & iframe & WebView的更多相关文章

  1. react native 中webview内的点击事件传到外部原生调用

    先说一下我使用webview的时候遇到的一个功能需求 是这样的,上图中的这个页面是用h5做的,但是由于点击"我的优惠劵"是需要跳转到我原生的页面,也就是说我需要获得这个h5提供的点 ...

  2. React Native WebView关闭缓存

    React Native WebView关闭缓存 网上搜索没有找到关闭React Native下webview控件的缓存的方法,经测试找到解决方案,记录如下 核心思路:通过请求时设置请求头,使页面缓存 ...

  3. 基于webview的Hybrid app和React Native及html5

    基于webview的Hybrid app和React Native及html5 React Native 结合了 Web 应用和 Native 应用的优势,可以使用 JavaScript 来开发 iO ...

  4. [React Native] Using the WebView component

    We can access web pages in our React Native application using the WebView component. We will connect ...

  5. React Native组件介绍

    1.React Native目前已有的组件 ActivityIndicatorIOS:标准的旋转进度轮; DatePickerIOS:日期选择器: Image:图片控件: ListView:列表控件: ...

  6. react native 入门实践

    上周末开始接触react native,版本为0.37,边学边看写了个demo,语法使用es6/7和jsx.准备分享一下这个过程.之前没有native开发和react的使用经验,不对之处烦请指出.希望 ...

  7. React Native Changed the World? or Nothing.

    RN是一个awesome的技术, facebook很有想法的团队创造出一项新的技术改变了native开发界. 但是RN本身又疑点重重, RN是为了解决什么问题而存在的? 在诞生了一年后, RN又解决了 ...

  8. 30天React Native从零到IOS/Android双平台发布总结

    前言 本人有近十年的技术背景,除了APP开发之外对后端.前端等都比较熟悉,近期做一个APP项目需要IOS.Android两个平台都需要,只能硬着头皮上.其实很早就想开发APP也很早就接触Android ...

  9. React Native系列文章

    React Native版本升级的正确姿势 WebView JS与RN进行通讯 用API网关把API管起来 React-Native 给客户端来个「同音词模糊搜索」 30天React Native从零 ...

随机推荐

  1. Data Lake Analytics + OSS数据文件格式处理大全

    0. 前言 Data Lake Analytics是Serverless化的云上交互式查询分析服务.用户可以使用标准的SQL语句,对存储在OSS.TableStore上的数据无需移动,直接进行查询分析 ...

  2. SLAM+语音机器人DIY系列:(三)感知与大脑——4.音响麦克风与摄像头

    摘要 在我的想象中机器人首先应该能自由的走来走去,然后应该能流利的与主人对话.朝着这个理想,我准备设计一个能自由行走,并且可以与人语音对话的机器人.实现的关键是让机器人能通过传感器感知周围环境,并通过 ...

  3. Java基础之 反射是什么?

    什么是反射,反射能干嘛? 反射是:指程序可以访问.检测和修改它本身状态或行为的一种能力 反射是一种能力,所以给的定义就是说明了它能干嘛. 我们平时用反射主要做: 获取类型的相关信息 动态调用方法 动态 ...

  4. es6涉及的那点东西

    前言 ECMAScript 6(以下简称ES6)是JavaScript语言的下一代标准.因为当前版本的ES6是在2015年发布的,所以又称ECMAScript 2015. 也就是说,ES6就是ES20 ...

  5. 《C#并发编程经典实例》学习笔记—2.6 任务完成时的处理

    问题 正在 await 一批任务,希望在每个任务完成时对它做一些处理.另外,希望在任务一完成就立即进行处理,而不需要等待其他任务. 问题的重点在于希望任务完成之后立即进行处理,而不去等待其他任务. 这 ...

  6. 程序猿想聊天 - 創問 4C 團隊教練心得(二)

    在第二天裡,主要談的是關於 Courage (勇氣) . Co-Create (共創) 的部分因為我們不是真實的團隊,就沒有繼續下去了 一早開始先回顧了一下前一天的內容,接下來我們就開始玩小遊戲 這個 ...

  7. C#打印模板设计,E店宝打印模板设置,winfrom打印模板设计,DevExpress.XtraReports.UI.XRTable 表格代码生成。

    一.打印效果 二.代码编辑 1 .table1 : table控件的Name: 2.label33 :label控件 实现绑定[外部平台单号]的控件: 3.label32:绑定[E店宝订单编号](S开 ...

  8. python在sqlite动态创建表源码

    代码之余,将开发过程中经常用的代码片段备份一下,如下的代码是关于python在sqlite动态创建表的代码,应该能对各位有所用. import sqlite3 as db conn = db.conn ...

  9. VUE新版扫码下单必选分类设置FAQ

    使用场景:商家想要设置某些分类下的商品设置必选,否则不能下单.如某火锅店,商家想要设置汤底这个分类下的商品,顾客扫码下单的时候必须选择一份才能下单,此时 就可以使用这个功能 配置步骤和注意事项如下: ...

  10. 如何从GitHub下载csv文件

    当打开存.csv文件的页面时,不用直接点击页面的Download,这样会使csv文件直接用浏览器打开. 要点击Raw按钮,鼠标右键,文件另存为,可以直接把csv文件下载到本地.