Comments (4)
I having the same issue.
addOrientationListener
has to params: orientation
and deviceOrientation
. orientation
seems to be returning the previews orientation, while deviceOrientation
is returning the correct orientation.
Btw, getOrientation
also have the same two params (orientation
and deviceOrientation
). I am getting the correct orientation on orientation
and deviceOrientation
is alwais undefined
.
EDIT:
I was also having issue #8 . After enabling the flag "Requires full screen" in the Target General settings (Deployment info), addOrientationListener started returning the correct orientation in the first parameter (both parameters orientation
and deviceOrientation
now return the same thing)
from react-native-orientation-locker.
@Fsarmento
thank you, I have fixed sample codes.
from react-native-orientation-locker.
orientation is the UI orientation, if you locked, it will not changed when rotating device.
deviceOrientation is the real device orientation, if you locked, it still can return current orientation of device.
You said deviceOrientation is alwais undefined
,
can you tell me which platform happened? android or iOS?
from react-native-orientation-locker.
I guess it is expected to be undefined... I was misled by the example in the README.md file:
//get current orientation
/*
Orientation.getOrientation((orientation,deviceOrientation)=> {
console.log("Current UI Orientation: ", orientation);
console.log("Current Device Orientation: ", deviceOrientation);
});
*/
However, a few lines below the definition of the getOrientation
method shows that the callback only have one parameter. To get the device orientation there is the getDeviceOrientation
.
getOrientation(function(orientation))
getDeviceOrientation(function(orientation))
Everything works as you explained π
from react-native-orientation-locker.
Related Issues (20)
- Compatibility with React Native 0.71.1
- Compatibility with React Native 0.71.1 HOT 7
- Getting null to all methods of Orientation class HOT 8
- Landscape mode on iPad.
- publish latest version - IE 1.6.0|2.0.0 to npm
- lockOrientation on ipad doesn't work HOT 3
- when will you upgrade your package 0.73
- IOS : app crash when orientation changed HOT 2
- OrientationType is not matching exported constants
- Feature-Suggestion: Migrate iOS Part to Swift
- Support new React Native new architecture (TurboModules/Fabric)
- Landscape mode on real device shows half screen but works well on emulator IOS HOT 1
- ζ¨ͺε±ηζΆεοΌηΌΊδΊδΈεεΏ HOT 2
- Landscape orientaion is not working on iphone 7 HOT 4
- App was working normally, when I ran it again this error occurred, what would be a possible solution? HOT 7
- IOS 12 crashing when calling Orientation.lockToLandscape() HOT 2
- Here is Kotlin code for Android installation HOT 4
- package for RN 0.73.1 ? HOT 2
- Task: react-native-orientation-locker: compileDebugJavaWithJavac FAILED HOT 7
- getAutoRotateState always returning `true` on iOS and `false` on Android HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-orientation-locker.