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

Screen rerender issue after using this library #293

Open ionictest2017 opened 8 months ago

ionictest2017 commented 8 months ago

here my code

function OnEnterHandleFullscreen() { console.log('OnEnterHandleFullscreen') if (isMobilePlatform) state.fullscreen ? Orientation.unlockAllOrientations() : Orientation.lockToLandscapeLeft(); }

function OnExitHandleFullscreen() { console.log('OnExitHandleFullscreen') if (isMobilePlatform) { setState({...state, fullscreen: false}); } }

{!Platform.isTV && Platform.OS !== 'web' && ( <OrientationLocker orientation={state.fullscreen ? LANDSCAPE : PORTRAIT} onChange={orientation => { console.log('--orientation fullscreen--',state.fullscreen) if (orientation !== PORTRAIT) { setState({...state, fullscreen: true}); } else { setState({...state, fullscreen: false}); } }} onDeviceChange={orientation => console.log('onDeviceChange', orientation) } /> )}

"react-native-orientation-locker": "^1.6.0",

IgorGanapolsky commented 5 months ago

@ionictest2017 Could you please format your code to be easy to read, so that we could troubleshoot for you?