React Native Expo app not locking in PORTRAIT mode for iPads

I need to force my React Native Expo app to always run on PORTRAIT mode on all devices due to how it’s built but it doesn’t work for iPads.

I have tried setting the orientation in the app.json file to portrait and this works fine for almost all devices except iPads. This is crucial because apple is very pedantic about the app’s design. I also tried ‘expo-screen-orientation’ and it didn’t work too. Any suggestions would be greatly helpful, thanks a ton guys!

Below are some relevant snippets:

"expo": { "name": "<app name>", "slug": "<app name>", "version": "1.0.0", "orientation": "portrait", "scheme": "<scheme>", "icon": "./assets/icon.png", "userInterfaceStyle": "light", "plugins": ["@react-native-google-signin/google-signin", "expo-screen-orientation" ], "assetBundlePatterns": [ "**/*" ],

App.js

useEffect(() => { (async () => { try { await ScreenOrientation.lockAsync(ScreenOrientation.OrientationLock.PORTRAIT_UP); } catch (error) { console.error(error); } })(); }, []);

I have this function (I know I don’t need the await, but I wanted to try it nonetheless as it didn’t work without it anyway).

exposdk:48.0.0
Platform: Ipads

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.