React Native & iframe & WebView
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的更多相关文章
- react native 中webview内的点击事件传到外部原生调用
先说一下我使用webview的时候遇到的一个功能需求 是这样的,上图中的这个页面是用h5做的,但是由于点击"我的优惠劵"是需要跳转到我原生的页面,也就是说我需要获得这个h5提供的点 ...
- React Native WebView关闭缓存
React Native WebView关闭缓存 网上搜索没有找到关闭React Native下webview控件的缓存的方法,经测试找到解决方案,记录如下 核心思路:通过请求时设置请求头,使页面缓存 ...
- 基于webview的Hybrid app和React Native及html5
基于webview的Hybrid app和React Native及html5 React Native 结合了 Web 应用和 Native 应用的优势,可以使用 JavaScript 来开发 iO ...
- [React Native] Using the WebView component
We can access web pages in our React Native application using the WebView component. We will connect ...
- React Native组件介绍
1.React Native目前已有的组件 ActivityIndicatorIOS:标准的旋转进度轮; DatePickerIOS:日期选择器: Image:图片控件: ListView:列表控件: ...
- react native 入门实践
上周末开始接触react native,版本为0.37,边学边看写了个demo,语法使用es6/7和jsx.准备分享一下这个过程.之前没有native开发和react的使用经验,不对之处烦请指出.希望 ...
- React Native Changed the World? or Nothing.
RN是一个awesome的技术, facebook很有想法的团队创造出一项新的技术改变了native开发界. 但是RN本身又疑点重重, RN是为了解决什么问题而存在的? 在诞生了一年后, RN又解决了 ...
- 30天React Native从零到IOS/Android双平台发布总结
前言 本人有近十年的技术背景,除了APP开发之外对后端.前端等都比较熟悉,近期做一个APP项目需要IOS.Android两个平台都需要,只能硬着头皮上.其实很早就想开发APP也很早就接触Android ...
- React Native系列文章
React Native版本升级的正确姿势 WebView JS与RN进行通讯 用API网关把API管起来 React-Native 给客户端来个「同音词模糊搜索」 30天React Native从零 ...
随机推荐
- Celery工具
什么是Celery Celery的功能 Celery是基于python实现的第三方组件,可以实现定时任务.周期任务等. Celery的组成 Celery的角色 - 任务,创建或发布任务. - 使用re ...
- pm2通过配置文件部署nodejs代码到服务器
一.pm2文档地址: http://pm2.keymetrics.io/ 二.在本地项目下新建ecosystem.config.js文件,并且推送到远端(记得node_modules这个文件夹也得推送 ...
- DS控件库 DSLed控件呈现滚动字幕效果
滚动字幕效果在DSled上可以使用偏移来实现,代码如下 运行效果
- DSAPI实现简单的透明窗体
代码 Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Dim B As New Bitmap( ...
- 【网摘】EasyUI常用控件禁用启用方法
1.validatebox可以用的用法:前两种适用于单个的validatebox; 第三种应用于整个form里面的输入框; <1>.$("#id").attr(&quo ...
- WebSocketSharp 的使用
Server 端示例代码: class Program { static void Main(string[] args) { var wssv = new WebSocketServer(" ...
- Java基础-异常、断言
处理错误 如果Java程序运行期间出现了错误,并且由于出现错误导致某些操作没有完成,程序应该能够返回到一种安全状态,并能够让用户执行一些其他的命令:或者允许用户保存所有操作结果,并以妥善的方式终止程序 ...
- Math.floor(Math.random()*3+1)
Math.random():获取0~1随机数 Math.floor() method rounds a number DOWNWARDS to the nearest integer, and ret ...
- Dotspatial 空间要素选择
//通过遍历选择要素,获取选择要素相交的要素 private void toolStripButton43_Click(object sender, EventArgs e) { //查看与选中要素重 ...
- Android Studio打包SDK后,为什么没有bundles文件夹?
在Android Studio中,将项目打包成jar包,按照网上说的方法打包完成后,在intermediates文件夹下没有bundles,AS版本3.1.2,后来发现,原来是intermediate ...