The app I’m creating is primarily in portrait mode, however, there is one screen that needs to be locked in landscape mode due to its functionality. I have installed the appropriate modules expo install expo-screen-orientation
, but still seem to get an error that I’m unable to resolve. I get the following error
Error: The method or property ScreenOrientation.lockAsync is not available on ios, are you sure you’ve linked all the native dependencies properly?
Below is a snippet of my code.
import React, { useEffect } from 'react'
import { View, Text } from 'react-native'
import * as ScreenOrientation from 'expo-screen-orientation'
const GameModeScreen = () => {
useEffect(() => {
const changeScreenOrientation = async () => {
await ScreenOrientation.lockAsync(
ScreenOrientation.OrientationLock.LANDSCAPE_RIGHT
)
}
changeScreenOrientation()
})
return (
<View>
<Text>Hello from the GameModeScreen</Text>
</View>
)
}
export default GameModeScreen
Any suggestions on how to solve this issue???