Anyone have any simple example on what parameter to pass to
ScreenOrientation.addOrientationChangeListener()
After looking at the docs here and playing around with it, I still can’t understand how to use it.
The docs say
listener (OrientationChangeListener)
Each orientation update will pass an object with the new OrientationChangeEvent to the listener.
And there is a link to a change event here
This is what my code looks like:
const orientationListener = async () => {
ScreenOrientation.addOrientationChangeListener(
ScreenOrientation.ScreenOrientationInfo.orientation
);
};
but I am getting a type error in VSCode. That’s where I am stuck. What argument to pass to ScreenOrientation.addOrientationChangeListener()
? I am getting an error
property 'orientationchangelistener' does not exist on type 'typeof import' (path to node_modules folder where ScreenOrientation package is installed) ts
which doesn’t make sense since I have this at the top of the file:
import * as ScreenOrientation from "expo-screen-orientation";