question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[SDK 39] StatusBar not respecting device orientation (iOS)

See original GitHub issue

Although I set the orientation to “portrait” in app.json, the statusbar still rotates in the Expo Client … same issue as this one on SDK 37: https://github.com/expo/expo/issues/933#issue-272031776

Adding:

ScreenOrientation.lockAsync(
   ScreenOrientation.OrientationLock.PORTRAIT
)

in App.js didn’t change anything.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:20
  • Comments:28 (2 by maintainers)

github_iconTop GitHub Comments

7reactions
xavax31commented, Jun 17, 2021

Reproducible sample: minimal expo app with only expo-screen-orientation package added. Tested on: expo go client 2.19.6.1011482 (last at today) exposdk 41.0.0 iphone se (1st generation) ios 14.4.2

Problem is only on ios.

NOTE : I made a snack too with same code, and it’s working when I use it. BUT if I download snack project and test it, error comes back. What can be the reason? https://snack.expo.io/@xavax/orientation-bug-on-ios

import { StatusBar } from "expo-status-bar";
import React, { useEffect } from "react";
import { StyleSheet, Text, View } from "react-native";
import * as ScreenOrientation from "expo-screen-orientation";

export default function App() {
	useEffect(() => {
		(async () => {
			await ScreenOrientation.lockAsync(
				ScreenOrientation.OrientationLock.PORTRAIT_UP
			);
		})();
	}, []);

	return (
		<View style={styles.container}>
			<Text>Orientation Test</Text>
			<Text>
				On ios, if I turn the device, this text don't move but
				statusBar turns, either ScreenOrientation is locked to
				PORTRAIT_UP
			</Text>
			<StatusBar style="auto" />
		</View>
	);
}

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

https://user-images.githubusercontent.com/4051022/122367112-701fb880-cf5c-11eb-92b3-e8ed1ce5348a.mp4

4reactions
lc3t35commented, Dec 13, 2020

It is still the same with SDK40

Read more comments on GitHub >

github_iconTop Results From Across the Web

'statusBarOrientation' was deprecated in iOS 13.0 when ...
'statusBarOrientation' was deprecated in iOS 13.0: Use the interfaceOrientation property of the window scene instead. How can I go about getting ...
Read more >
Device Orientation Bug | Apple Developer Forums
I just created a new Xcode project, and only selected portrait orientation, but when I rotate my iPhone, it shows the landscape view...
Read more >
Troubleshooting - Helpshift for iOS - Developer Guide
On iOS 8, Helpshift SDK's navigation bar covers status bar after a change of orientation. To fix this, implement following method in the ......
Read more >
iOS Auto Layout tutorial programmatically - The.Swift.Dev.
If your application is going to support multiple device orientations, you should implement the following methods inside your view controller.
Read more >
'statusbarframe' was deprecated in ios 13.0 - You.com
Status bar does not respect the orientation value, thus status bar height ... -4.0.0+4/ios/Classes/InAppWebView.swift:1248:39: warning: 'javaScriptEnabled' ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found