NOTE i am aware there are many post about this already. But all are somewhat outdated and not a single one fixes the issue hence i am posting a new one.
Issue
Cant lock a specific screen orientation for ipad.
Packages
"expo": "~44.0.0",
"expo-screen-orientation": "^4.1.2",
"react": "17.0.1",
"react-dom": "17.0.1",
"react-native": "0.64.3",
(Ands loads of others that arent relevent)
Info
Trying to lock a screen orientation to landscape. Here's the catch: on mobile it should be portrait but on tablet - landscape. Mobile works fine (both orientations), but on tablet - cant seem to make it work.
And yes, I did add "requireFullScreen": true to app.json. and app.json does NOT contain orientation property (tried with it too tho).
FUN FACT - tried setting orientation to landscape on app.json and on iPhone it was fine but on iPad - did nothing. I could still rotate the screen just fine.
Code
In the top most app (app.js) I create a simple method (inside function App() ):
const foo = async () => {
await ScreenOrientation.lockAsync(ScreenOrientation.OrientationLock.LANDSCAPE_LEFT);
};
And i call it: foo();
Then the return (that is not relevent). NOTE the app is returned like so export default registerRootComponent(App);
If using an iPhone - it works fine. But with iPad - i can rotate the screen (aka its not locked).
Tried many different iPads (emulators) and none seem to work.
As mentioned - there are many reports but none seem to be up to date nor working.