Created
February 17, 2016 22:36
-
-
Save jimthedev/d4bd0626da6d7cb3d5d4 to your computer and use it in GitHub Desktop.
Reduce orientation events coming from react-native-orientation npm module
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function _reduceOrientation(lastOrientation, orientation) { | |
if(orientation==='UNKNOWN' && lastOrientation==='UNKNOWN') { | |
return 'UNKNOWN'; | |
} | |
switch(orientation) { | |
case 'LANDSCAPE': | |
case 'PORTRAIT': | |
return orientation; | |
case 'UNKNOWN': | |
return lastOrientation; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Expected output: