Skip to content

[ScreenOrientation] Cant Lock to Landscape on iOS Client 2.12.1 [SDK 34] #5188

@bruno-edo

Description

@bruno-edo

🐛 Bug Report

Before updating to SDK 34 (and the new Expo app for iOS) the orientation lock through app.json worked correctly, now it doesn't work anymore.

Environment

  Expo CLI 3.0.6 environment info:
    System:
      OS: macOS 10.14.6
      Shell: 3.0.2 - /usr/local/bin/fish
    Binaries:
      Node: 12.6.0 - /usr/local/bin/node
      Yarn: 1.17.3 - /usr/local/bin/yarn
      npm: 6.9.0 - /usr/local/bin/npm
    IDEs:
      Xcode: 10.3/10G8 - /usr/bin/xcodebuild
    npmPackages:
      expo: ^34.0.0 => 34.0.3 
      react: 16.8.3 => 16.8.3 
      react-native: https://github.com/expo/react-native/archive/sdk-34.0.1.tar.gz => 0.59.8 
      react-navigation: ^3.11.1 => 3.11.1

Targets: iOS.

Steps to Reproduce

  • Create project using SDK 34;
  • Set orientation to landscape in your app.json file;
  • Open app on simulator;
  • Roatate device a few times.

Expected Behavior

App should only allow the landscape orientation.

Actual Behavior

App allows both landscape and portrait orientations.

Reproducible Demo

I've set my app.json file like so:

{
  "expo": {
    "name": "test",
    "slug": "test",
    "privacy": "unlisted",
    "sdkVersion": "34.0.0",
    "platforms": [ "ios" ],
    "version": "0.1.0",
    "orientation": "landscape",
    "icon": "./assets/icon.png",
    "splash": {
      "image": "./assets/splash.png",
      "resizeMode": "contain",
      "backgroundColor": "#ffffff"
    },
    "updates": {
      "enabled": true,
      "checkAutomatically": "ON_LOAD"
    },
    "assetBundlePatterns": [
      "**/*"
    ],
    "ios": {
      "bundleIdentifier": "test",
      "buildNumber": "0.1.0",
      "supportsTablet": true,
      "isTabletOnly": true
    }
  }
}

And also tried using the ScreenOrientation API on my App.js file:

/* eslint-disable react/prefer-stateless-function */
import React, { Component } from 'react';
import { ActivityIndicator } from 'react-native';
import { Provider } from 'react-redux';
import { PersistGate } from 'redux-persist/es/integration/react';
import { Provider as PaperProvider, Portal } from 'react-native-paper';
import { ScreenOrientation } from 'expo';

import configureStore from './src/store/store';
import Navigator from './src/navigation/AppNavigator';
// eslint-disable-next-line no-unused-vars
import i18n from './src/config/i18n';

const { persistor, store } = configureStore();

export default class App extends Component {
  async componentDidMount() {
    await ScreenOrientation.lockAsync(ScreenOrientation.OrientationLock.LANDSCAPE);
  }

  render() {
    return (
      <Provider store={store}>
        <PaperProvider>
          <PersistGate loading={<ActivityIndicator />} persistor={persistor}>
            <Portal.Host>
              <Navigator />
            </Portal.Host>
          </PersistGate>
        </PaperProvider>
      </Provider>
    );
  }
}

Metadata

Metadata

Labels

ScreenOrientationhomeThe user interface for the generic development clientiOS

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions