React native 仅对一个页面响应本机横向模式

React native 仅对一个页面响应本机横向模式,react-native,React Native,在react native中,是否可以让应用程序以纵向模式运行,而以横向模式运行一个页面?我知道在xcode中,您必须在开始时选择纵向或横向,因此我对如何在应用程序中创建除一个页面以外的所有页面感到有点困惑。有一个构建良好的软件包: 唯一的缺点是,您需要在应用程序的每个场景中指定方向: Orientation.lockToPortrait() 或 Orientation.lockToLandscape()我希望这个答案能对你有所帮助 Project->_text->android->app->s

在react native中,是否可以让应用程序以纵向模式运行,而以横向模式运行一个页面?我知道在xcode中,您必须在开始时选择纵向或横向,因此我对如何在应用程序中创建除一个页面以外的所有页面感到有点困惑。

有一个构建良好的软件包:

唯一的缺点是,您需要在应用程序的每个场景中指定方向:

Orientation.lockToPortrait()


Orientation.lockToLandscape()

我希望这个答案能对你有所帮助

Project->_text->android->app->src->main->AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.reactnativeweb">

    <uses-permission android:name="android.permission.INTERNET" />

    <application
      android:name=".MainApplication"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:allowBackup="false"
      android:theme="@style/AppTheme">
      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:screenOrientation="landscape"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
        android:launchMode="singleTask"
        android:windowSoftInputMode="adjustResize">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
      </activity>
      <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
    </application>

</manifest>
 

检查我也一直在使用这个,但在RN0.44:'中无法再让它工作(IOS如何?Xcode有一个选项general->deployemnt info->device orientation device orientation可根据需要选择landspace left landspace right
android:screenOrientation="landscape"