Giter Site home page Giter Site logo

Comments (22)

takameyer avatar takameyer commented on June 3, 2024 25

I had to enable „Requires full screen“ in the Target General settings (Deployment info)

from react-native-orientation-locker.

wonday avatar wonday commented on June 3, 2024 8

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.

chrismang avatar chrismang commented on June 3, 2024 7

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.

DragonSpirit avatar DragonSpirit commented on June 3, 2024 3

Not work on ipad without "Requires full screen", can I use without this checkbox?

from react-native-orientation-locker.

HaseemUlHaq avatar HaseemUlHaq commented on June 3, 2024 2

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.

paulxuca avatar paulxuca commented on June 3, 2024 1

#38

from react-native-orientation-locker.

matej-cepil avatar matej-cepil commented on June 3, 2024 1

@paulxuca Thanks a lot. Now it works as expected.

from react-native-orientation-locker.

eramudeep avatar eramudeep commented on June 3, 2024 1

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.

anisurrahman072 avatar anisurrahman072 commented on June 3, 2024 1

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.

takameyer avatar takameyer commented on June 3, 2024

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.

Thanmai-C avatar Thanmai-C commented on June 3, 2024

@wonday @takameyer Any solution to lock to portrait on iOS?

from react-native-orientation-locker.

Thanmai-C avatar Thanmai-C commented on June 3, 2024

But still it doesn't work for me.
@wonday doesn't work on iOS?

from react-native-orientation-locker.

wonday avatar wonday commented on June 3, 2024

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.

ZeroCool00 avatar ZeroCool00 commented on June 3, 2024

Any solution yet? locktoLandscape also not working in ios. Android is fine

from react-native-orientation-locker.

wonday avatar wonday commented on June 3, 2024

I have an example that uses it, you can see the project setting and usage.
here

from react-native-orientation-locker.

Theng avatar Theng commented on June 3, 2024

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.

paulxuca avatar paulxuca commented on June 3, 2024

@Theng

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.

wonday avatar wonday commented on June 3, 2024

@paulxuca
Your fork seems no problem, can you send a PR to me?

from react-native-orientation-locker.

paulxuca avatar paulxuca commented on June 3, 2024

Cool! Thank you.

from react-native-orientation-locker.

Theng avatar Theng commented on June 3, 2024

@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.

ShantiRanjanDas avatar ShantiRanjanDas commented on June 3, 2024

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.

ieroshenko avatar ieroshenko commented on June 3, 2024

@chrismang your code works for locking, but device orientation listener stops working in my case

from react-native-orientation-locker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.