首页 > 解决方案 > 闪屏后 iPad 屏幕旋转 180 度

问题描述

这是问题的视频

应用程序在 iPad 上加载后颠倒,手动 180 度旋转后,应用程序按预期工作

在真实 iPad 设备上的行为相同,适用于 Android

方向:在 app.json 配置中锁定为“横向”

我的 App.js 文件:

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

const App = () => {
  return (
    <View style={{ flex: 1, backgroundColor: 'grey', justifyContent: 'center', alignItems: 'center' }}>
      <Text style={{ position: 'absolute', fontSize: 30, top: 0 }}>TOP</Text>
      <Text style={{ position: 'absolute', fontSize: 30, left: 0 }}>LEFT</Text>
      <Text style={{ position: 'absolute', fontSize: 30, right: 0 }}>RIGHT</Text>
      <Text style={{ position: 'absolute', fontSize: 30, bottom: 0 }}>BOTTOM</Text>
    </View>
  );
};

export default App;

博览会 SDK:“^37.0.0”

我的 app.json 文件:

{
  "expo": {
    "packagerOpts": {
      "config": "metro.config.js",
      "sourceExts": [
        "js",
        "jsx",
        "ts",
        "tsx",
        "svg"
      ]
    },
    "name": "My Test App",
    "slug": "my-test-app",
    "privacy": "public",
    "platforms": [
      "ios"
    ],
    "version": "1.2.6",
    "orientation": "landscape",
    "splash": {
      "image": "./assets/splash2.png",
      "resizeMode": "contain",
      "backgroundColor": "#113F67"
    },
    "updates": {
      "fallbackToCacheTimeout": 0
    },
    "assetBundlePatterns": [
      "**/*"
    ],
    "ios": {
      "bundleIdentifier": "ru.my.testapp",
      "buildNumber": "1.2.6",
      "supportsTablet": true,
      "isTabletOnly": true,
      "requireFullScreen": true,
      "infoPlist": {
        "NSLocationWhenInUseUsageDescription": "location"
      },
      "config": {
        "googleMapsApiKey": "api-key"
      }
    },
    "description": ""
  }
}

标签: react-nativeexporeact-native-ios

解决方案


推荐阅读