-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ScreenOrientation] iOS orientation lock doesn't work until backgrounded/foregrounded #11558
Comments
Facing the same issue did anyone found any resolution to the mentioned problem. |
Facing this error too after restart app using Any ideas ? |
Same issue! Would be interested in a fix (this seems to affect EAS builds/custom dev clients, so presumably standalone builds too). |
@computerjazz did you ever dig further into a more semantic fix? Any qualms if I try to upstream your temporary fix? |
@tsapeta thanks for fixing this. Any idea when this will be released? |
Hi @Saifadin, the package is already published under |
@tsapeta Any ETA for SDK43 and the blogpost on how to migrate from unimodules? This is currently a big Blocker for our further Development. |
@tsapeta we just upgraded to SDK 43 and updated to expo-modules. But this error is still persisting and does not apply. This is the code we are using: useEffect(() => {
const lockScreen = async () => {
await ScreenOrientation.lockAsync(ScreenOrientation.OrientationLock.LANDSCAPE);
const result = await ScreenOrientation.getOrientationAsync();
// This logs 1, which is portrait
console.log(result);
};
lockScreen();
getPermissions();
return () => ScreenOrientation.lockAsync(ScreenOrientation.OrientationLock.PORTRAIT_UP);
}, []); Edit: #import <UMCore/UMAppDelegateWrapper.h>
@interface AppDelegate : UMAppDelegateWrapper <RCTBridgeDelegate> But in the Upgrade to expo-modules Guide it is supposed to be like this: -#import <UMCore/UMAppDelegateWrapper.h>
+#import <Expo/Expo.h>
-@interface AppDelegate : UMAppDelegateWrapper <RCTBridgeDelegate, EXUpdatesAppControllerDelegate>
+@interface AppDelegate : EXAppDelegateWrapper <RCTBridgeDelegate> |
Currently facing this same issue on EAS with SDK43. The screen won't rotate to landscape right even after foregrounding/backgrounding and this is for a managed flow |
Any news on that one? Still facing the exact same issue. Works well within the Expo Go app, but fails with EAS builds |
Encountering this now on EAS build with SDK 47, just on iOS landscape screen lock no longer engages. I just upgraded to EAS build from expo build and now this is an issue. Background/foreground doesn't matter |
I have the same issue as @VahanLab |
@fredrikburmester I added this to my ios in app.json:
Then dropped the default (old) recommended config that was: "orientation": "portrait", Then it seemed to work fine for me, for anyone else I found this from digging for awhile through all the issues |
Thank you @GrahamEvans31 this worked! 👍🏻 To clarify for anyone who's having the same problem, this is where I put the code in my
|
🐛 Bug Report
Summary of Issue
In the bare workflow, Locking orientation doesn't work until the app has been backgrounded and foregrounded.
I traced this down to the fact that a new
EXScreenOrientationModule
module is instantiated every JS refresh. Since this module relies on native app foreground/background lifecycle methods to register itself, it was not getting registered until the user manually triggers an app foreground/background. Adding the following patch fixes the behavior, as it manually registers the module by callingmoduleDidForeground
but this does not seem semantically correct.Is the module supposed to be a singleton?
Environment - output of
expo diagnostics
& the platform(s) you're targetingPlatform: iOS
Reproducible Demo
https://github.com/computerjazz/expo-orientation-bug
Steps to Reproduce
Expected Behavior vs Actual Behavior
Expected: Rotation lock continues to work after refreshing JS
Actual: App does not lock to orientation after refreshing JS
The text was updated successfully, but these errors were encountered: