React-Native: Orientation.lockToLandscape() in componentWillUnmount takes time to work

Viewed 94

I'm using webview to play a video on full screen in landscape mode in my react native app .on returning to previous page I want protrait mode back.(Ie :I only need landscape mode for video player page and portrait mode in rest of the pages)

code

    componentWillUnmount(){
       Orientation.lockToPortrait();
      }
componentDidMount() {
    Orientation.lockToLandscape(); 
}

This code works, but on navigating back the view remains in landscape mode for a short period of time. How can I get the view to rotate to portrait mode immediately on returning from video player page?

0 Answers
Related