Giter Site home page Giter Site logo

Comments (6)

wonday avatar wonday commented on June 3, 2024 1

only video page can Landscape?
you can lockToPortrait() at other page and
unlockAllOrientations() when enter video page
lockToPortrait() again when leave video page

from react-native-orientation-locker.

gp3gp3gp3 avatar gp3gp3gp3 commented on June 3, 2024 1

@wonday I see this issue is closed, but I am experiencing it as a bug in this new package for Android.

In the previous react-native-orientation package, the event listeners would not emit the orientation changes if the phone auto-rotate was set to off by the user. Now in this new package, it does.

This is unfortunate because I could really use this feature that has been added to this package, getting the device orientation even when we have locked the orientation via JS code. But I also need to be able to disregard all orientation logic if the user has locked the auto-rotate status of their device.

EDIT: I am mistaken, the previous library doesn't do this. But this issue is still valid, I need a way to disregard all orientation logic if the user has selected auto-rotate to be false

from react-native-orientation-locker.

b-asaf avatar b-asaf commented on June 3, 2024

I tried this approach with react-native-orientation package and did no work, I wanted to validate that this approach will work with this package before making the change.
thanks @wonday

from react-native-orientation-locker.

mtshrmn avatar mtshrmn commented on June 3, 2024

This is a real issue. Can we reopen it?

from react-native-orientation-locker.

wonday avatar wonday commented on June 3, 2024

merged and released to v1.0.22

from react-native-orientation-locker.

 avatar commented on June 3, 2024

This is not a valid solution or rather to be precise, this solution is incomplete.

Consider device is locked to portrait mode

If login is implemented in portrait mode only and the rest of the pages supports all the orientations,
Inside Login Page ComponentDidMount, call the method to lock to portrait mode
Inside Login Page ComponentDidUnmount, that is when moving into the next pages of the application,

// Inside Component Did Mount
Orientation.getAutoRotateState(s => {
    if (s) Orientation.unlockAllOrientations();
});

After entering the page, unlock all the orientations. there is no event emitter to listen to changes in autorotate state.

Instead of bringing the previous functionality where events are not emitted when autorotate is off, this solution provided is incomplete.

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.