android - 如何在react-native应用程序中打开网站(Android和iOS)

标签 android ios react-native

我需要在我的 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}}
      />
    );
  }
}

关于android - 如何在react-native应用程序中打开网站(Android和iOS),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58534466/

相关文章:

java - 一个 Activity 和屏幕旋转中的两个 SearchView

ios - Facebook SDK 适用于模拟器,但不适用于真正的 Iphone

iphone - 从第二个 ViewController 到第一个 ViewController

ios - 如何使用image发送通知 - react-native-firebase

android - react 原生 : How to open OS settings in Android and iOS?

java - Android 向 Pojo 类添加 json 数组

android - 我如何在 Textview setText Android 上进行计算

java - android.util.GregorianCalendar : will c. add(Calendar.DAY_OF_MONTH, 1) 回滚还是前进?

iphone - 图片命名约定困惑与UIBarButtonItem

javascript - 在 React Native 中通过 Navigator 传递套接字