Please provide the following:
- SDK Version: 37
- Platforms(Android/iOS/web/all):all
I’m attempting to have a screen display in Landscape mode. Without the call to lockAsync
, everything works fine. When adding the call to lockAsync
, the screen correctly rotates, but then I get a React warning followed shortly thereafter by Warning: Maximum update depth exceeded. This can happen when a component calls setState inside useEffect
const Temp = ({ navigation }) => {
useEffect(() => {
changeScreenOrientation();
}, []);
const changeScreenOrientation = async () => {
await lockAsync(OrientationLock.LANDSCAPE_LEFT);
};
return (
<View>
<Text>test</Text>
<Button onPress={() => navigation.pop()} title="back" />
</View>
);
};
The useEffect call is only happening once, so something is causing an infinite loop or error when calling lockAsync
ExceptionsManager.js:126 Warning: State updates from the useState() and useReducer() Hooks don’t support the second callback argument. To execute a side effect after rendering, declare it in the component body with useEffect().
169ExceptionsManager.js:126 Warning: Maximum update depth exceeded. This can happen when a component calls setState inside useEffect