react-native - 如何通过 webview 方法在 React-native 中旋转 View

标签 react-native

我通过React Native制作了WebView方法。
使用“expo-cli”可以很好地加载 webview 主页。
但问题是 webview 不会通过我设备的景观模式旋转。
我怎么解决这个问题?太感谢了。

import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { WebView } from 'react-native';

export default function App() {
  return <WebView source={{ uri: 'http://111.111.111.111/web' }} />;
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center'
  }
});

最佳答案

您应该检查您的 app.json 文件。使用 Expo 创建的空白应用程序默认获取值 orientation: Portrait。您可以将其更改为默认。 世博文档:https://docs.expo.io/versions/latest/workflow/configuration/#orientation

关于react-native - 如何通过 webview 方法在 React-native 中旋转 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57107007/

相关文章:

reactjs - 如何将 'from outside' 链接到导航器(例如从全局页脚)

node.js - 使用nodejs和aws遇到403错误

android - react-native运行android失败

android - 当用户使用“主页”或“概述”按钮离开应用程序时,如何更新 React Native 中的组件?

android - React Native 中未知的随机内存崩溃

android - 在 Picker 中添加 API 数据值 react native

javascript - React Native 中的 Google 字体

javascript - React Navigation - 如何在 axios 实例中访问 this.props.navigation

react-native - useFocusEffect 不更新 setstate

android - React-Native Talkback 以错误的语言读取组件的可访问性角色