android - 如何在 react-native 应用程序中打开网站(Android 和 iOS)
问题描述
我需要在我的 react-native 应用程序中打开网站。需要同时适用于 iOS 和 Android
解决方案
您可以使用WebView
组件:https ://facebook.github.io/react-native/docs/webview.html 。
像这样的东西:
import React, { Component } from 'react';
import { WebView } from 'react-native';
class MyWebViewComponent extends Component {
render() {
return (
<WebView
source={{uri: 'https://google.com'}}
style={{marginTop: 10}}
/>
);
}
}
推荐阅读
- javascript - 使用TypeScript通过JSDocs检查JS时,如何声明一个变量对应一个命名空间?
- apache - 如何防止在 301 重定向中将参数添加到新网址的末尾?
- tfs - TFS 签入评论更改日志
- php - PHP:如何防止包含的文件覆盖全局变量?
- javascript - 如何在控制器上的 format.js 之后使用实例变量或参数 - Rails
- azure - 带有特殊字符的 Azure 连接字符串
- bash - 带有集群配置的 Couchbase docker 入口点
- vb.net - 处理数据集中的大型 XML 文件(内存不足)
- java - 证书更新后出现“SSLHandshakeException:签署证书验证时出错”
- javascript - 如何在javascript中可靠地找到分数和小数