I have to pressure my React Native Expo app to at all times run on PORTRAIT mode on all gadgets as a consequence of the way it’s constructed however it does not work for iPads.
I’ve tried setting the orientation within the app.json file to portrait and this works high-quality for nearly all gadgets besides iPads. That is essential as a result of apple may be very pedantic concerning the app’s design. I additionally tried ‘expo-screen-orientation’ and it did not work too. Any strategies can be enormously useful, thanks a ton guys!
Beneath are some related snippets:
"expo": { "identify": "<app identify>", "slug": "<app identify>", "model": "1.0.0", "orientation": "portrait", "scheme": "<scheme>", "icon": "./belongings/icon.png", "userInterfaceStyle": "mild", "plugins": ["@react-native-google-signin/google-signin", "expo-screen-orientation" ], "assetBundlePatterns": [ "**/*" ],
App.js
useEffect(() => { (async () => { strive { await ScreenOrientation.lockAsync(ScreenOrientation.OrientationLock.PORTRAIT_UP); } catch (error) { console.error(error); } })(); }, []);
I’ve this operate (I do know i do not want the await, however I wished to strive it nonetheless because it did not work with out anyway.
exposdk:48.0.0