react-native - React Native WebView 不工作 IOS 模拟器
问题描述
WebView 可以在 IOS 模拟器中工作吗?
下面的代码不会返回错误,也不会显示任何内容。
import React, { Component } from 'react';
import { WebView } from 'react-native';
class MyTest extends Component {
render() {
return (
<WebView
source={{uri: 'https://github.com/facebook/react-native'}}
style={{marginTop: 20}}
/>
);
}
}
export default MyTest;
谢谢
解决方案
WebView 在我的模拟器中运行良好。我的代码:
<WebView
useWebKit={true}
style={{flex:1}}
source={{uri:url}}
startInLoadingState={true}
renderLoading={()=>(<ActivityIndicator size='large' color={COLOR_STANDARD}
style={{marginTop:100}} />)}>
</WebView>
推荐阅读
- javascript - 打字时增加输入高度
- c++ - const 引用传递的参数的可变左值引用
- android - Android Studio:清单合并失败并出现多个错误
- amazon-web-services - 我无法读取环境变量(Go 中的 aws-lambda)
- linux - 什么是 rtnetlink(linux os),netlink 和 rtnetlink 有什么区别?
- angular - 我在我的 ASP.NET MVC & Entity Framework 项目中输入日期为“10/09/2019”,但在数据库中它保存为“1.1.0001 00:00:00”
- javascript - 循环的文件预览适用于一个项目,两个或多个文件重复上一个文件
- php - 如果有特定的 get 参数,则重定向到新地址
- java - 如何将两个不同的字符串日期转换为单个日期格式
- c# - 变量在 C# 应用程序中不断重置为 null,为什么?