I wan't to show a message to the user if his device orientation is locked, and I'm having trouble accessing this info.
I've tried using getOrientationLockAsync, but that only returns the apps orientation lock. Here is the code I've us
import { StatusBar } from 'expo-status-bar';
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import * as ScreenOrientation from 'expo-screen-orientation';
export default function App() {
ScreenOrientation.getOrientationLockAsync().then((res) => {
console.log('getOrientationLockAsync', res)
})
return (
<View style={styles.container}>
<Text>Open up App.js to start working on your app!</Text>
<StatusBar style="auto" />
</View>
);
}
And this always returns whathever is set in the app.json regardles if I set the device orientation to Portrait or Landscape.
If my app.json looks like this:
{
"expo": {
"name": "expo-ex",
"slug": "expo-ex",
"version": "1.0.0",
"orientation": "default",
...
}
}
The getOrientationLockAsync will always return '0' which corelates to 'OrientationLock.DEFAULT' even if I lock the device orientation to Landscape.
I also tried the fuction ScreenOrientation.getPlatformOrientationLockAsync() but that also doesn't do the trick.
The device I'm using is Samsung s10e and the SDK version of expo is 40.