Comments (22)
I had to enable „Requires full screen“ in the Target General settings (Deployment info)
from react-native-orientation-locker.
Do you config it like readme.ME?
You should add the following codes to iOS files,
#import "Orientation.h" // <--- import
@implementation AppDelegate
// ...
- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
return [Orientation getOrientation];
}
@end
from react-native-orientation-locker.
Try this configuration in AppDelegate.m:
#import "Orientation.h" // <--- import
@implementation AppDelegate
// ...
- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
while ([[UIDevice currentDevice] isGeneratingDeviceOrientationNotifications]) {
[[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
}
return [Orientation getOrientation];
}
@end
from react-native-orientation-locker.
Not work on ipad without "Requires full screen", can I use without this checkbox?
from react-native-orientation-locker.
Make sure you have installed Pods
cd ios && pod install
Use:
Orientation.lockToLandscape()
Orientation.lockToPortrait()
In AppDelegate.m
write before @end
- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow ``*)window {
while ([[UIDevice currentDevice] isGeneratingDeviceOrientationNotifications]) {
[[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
}
return [Orientation getOrientation];
}
from react-native-orientation-locker.
from react-native-orientation-locker.
@paulxuca Thanks a lot. Now it works as expected.
from react-native-orientation-locker.
Make sure you have installed Pods
cd ios && pod install
Use:
Orientation.lockToLandscape()
Orientation.lockToPortrait()
In AppDelegate.m write before
@end
- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow
*)window { ``while ([[UIDevice currentDevice] isGeneratingDeviceOrientationNotifications]) {
` [[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];` ` }`
return [Orientation getOrientation];
}
finally got the correct answer. !!!
Thank you
from react-native-orientation-locker.
Do you config it like readme.ME? You should add the following codes to iOS files,
#import "Orientation.h" // <--- import @implementation AppDelegate // ... - (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window { return [Orientation getOrientation]; } @end
It worked for me 🎉. Thanks you rock @wonday
from react-native-orientation-locker.
I'm having the same problem. AppDelegate.m is correctly configured. I'm receiving the events that the orientation has changed, but it will not lock. Can you provide an example where locking to portrait mode works?
from react-native-orientation-locker.
@wonday @takameyer Any solution to lock to portrait on iOS?
from react-native-orientation-locker.
But still it doesn't work for me.
@wonday doesn't work on iOS?
from react-native-orientation-locker.
After install, just call
import Orientation from 'react-native-orientation-locker';
...
Orientation.lockToPortrait();
My App work fine on Android and iOS.
from react-native-orientation-locker.
Any solution yet? locktoLandscape also not working in ios. Android is fine
from react-native-orientation-locker.
I have an example that uses it, you can see the project setting and usage.
here
from react-native-orientation-locker.
I have this problem too, Orientation.lockToPortrait() is working on IOS, but if the iPhone already in landscape and I open app, the app is rotate in the start up before it run Orientation.lockToPortrait(), so the component in my app render wrong, it be come bigger because I use device width to calculate the size of component. Ex: while watching youtube video in landscape, my app has a notification and then I click on notification while playing video in landscape.
from react-native-orientation-locker.
I have a fork of this repo which adds functionality to try to fix that: https://github.com/paulxuca/react-native-orientation-locker
Please let me know if that works and I'll open a PR here!
from react-native-orientation-locker.
@paulxuca
Your fork seems no problem, can you send a PR to me?
from react-native-orientation-locker.
Cool! Thank you.
from react-native-orientation-locker.
@paulxuca for me this is still not working, do I need to do something to my code or just change to your repo, this is the app I am working on https://streamable.com/5d72o , 1st I open it in portrait which working as I expected , 2nd I rotate iPhone to landscape then open the app, as you can see in video on the Launch screen it rotate then the component become bigger.
from react-native-orientation-locker.
It is also not working in my case @Theng , I am using your fork. Still not able to lock app in portrait mode, While its gets launched first time.
from react-native-orientation-locker.
@chrismang your code works for locking, but device orientation listener stops working in my case
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.