wonday / react-native-orientation-locker

A react-native module that can listen on orientation changing of device, get current orientation, lock to preferred orientation.
MIT License
761 stars 274 forks source link

Cannot read property 'locktoportrait' of null #302

Open Usman-02501 opened 1 month ago

Usman-02501 commented 1 month ago

useFocusEffect( React.useCallback(() => { return () => { Orientation.lockToPortrait(); StatusBar.setHidden(false); }; }, [navigation]), );

const handleFullscreenToggle = () => { if (isFullScreen) { Orientation.lockToPortrait(); setFullScreen(false); StatusBar.setHidden(false); setOrientation('portrait'); } else { Orientation.lockToPortrait(); setFullScreen(true); StatusBar.setHidden(true); setOrientation('portrait'); } };

const handleOrientationToggle = () => { if (orientation === 'landscape') { Orientation.lockToPortrait(); setOrientation('portrait'); } else { StatusBar.setHidden(true); Orientation.lockToLandscape(); setOrientation('landscape'); } }; How to solve this issue in expo for android platform.