All rights are reserved by Niteesh Kumar.. Theme images by Storman. Powered by Blogger.

Followers

Total Pageviews

Blog Archive

Translate

Tuesday, 13 August 2019

React Native Orientation not working iOS



While developing React Native Mobile Applications we often face challenges regarding device orientation. Common issues that we face are - 

  1. Get device Orientation
  2. Lock application to portrait mode 
  3. Lock application to landscape 
  4. Lock application to portrait mode and enable landscape mode for some screens only

for all those requirements listed above, we use the react-native-orientation library.

To setup the library follow the steps given in the documentation of react-native-orientation. follow the URL given below-


While setting up the library keep this thing in mind that in case of iOS linking the documentation says that you have to add following lines in AppDeligate.m file - 

- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window { while ([[UIDevice currentDevice] isGeneratingDeviceOrientationNotifications]) {< [[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications]; } return [Orientation getOrientation];
}


What I have noticed is that after making this change we will see some issues in iOS. Such that - 
  1. OrientaionListener is not working after lockToPortrait() or lockToLandscape() or UnlockAllOrientation()
  2. lockToPortrait() or lockToLandscape() or UnlockAllOrientation() are not working
  3. The device is not coming back to portrait mode after switching to landscape mode
  4. The device is not coming back to landscape mode after switching to portrait mode
To fix all those issues we need to make the below change. Instead of adding the lines sown above you only have to add the lines below-






- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window { return [Orientation getOrientation];
}

Because while loop in this creating problem and because of this some times orientation listeners are not getting triggered. 




26 on: "React Native Orientation not working iOS "
  1. Microsoft propelled Windows Phone in October 2010. So Windows Phone is relatively more youthful than other two versatile stages. download itools crack

    ReplyDelete
  2. Discover the advantages of versatile auto body repair administration.Iphone reparatur

    ReplyDelete
  3. Right off the bat, Android Inc. was an autonomous organization, later Google purchased that organization in 2005 and sold their first Android Smartphone in 2008. Then, iOS fueled Smartphone had acquired 2008 only a year prior to Android for iPhone by Apple Inc. kodi addons

    ReplyDelete
  4. This is my first time i visit here. I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here keep up the good work Iosemus

    ReplyDelete
  5. Really i appreciate the effort you made to share the knowledge. The topic here i found was really effective to the topic which i was researching for a long time basicknowledgehub

    ReplyDelete
  6. I agree so much. we should all be reinforcing positive feedback within the comment sections. So many good points to take into consideration.
    When people have good things to say about my web site Prasoon Kumar Arya it really makes positive impact.

    ReplyDelete
  7. I like your all post. You have done really good work. Thank you for the information you provide, it helped me a lot. I hope to have many more entries or so from you.
    Very interesting blog.
    wincracker.com
    Bitwig Studio crack
    Sidify Apple Music Converter crack

    ReplyDelete

  8. After looking through a few blog articles on your website,
    we sincerely appreciate the way you blogged.
    We've added it to our list of bookmarked web pages and will be checking back in the near
    future. Please also visit my website and tell us what you think.
    ABBYY FineReader Crack Crack

    ReplyDelete
  9. Is this a paid topic or do you change it yourself?
    However, stopping by with great quality writing, it's hard to see any good blog today.

    iTools Crack
    ReLoader Activator Crack

    ReplyDelete
  10. This site have particular software articles which emits an impression of being a significant and significant for you individual, able software installation.This is the spot you can get helps for any software installation, usage and cracked.
    itools-crack
    amazing-any-data-recovery-crack
    beecut-crack
    coreldraw-crack

    ReplyDelete
  11. I guess I am the only one who came here to share my very own experience. Guess what!? I am using my laptop for almost

    the past 2 years, but I had no idea of solving some basic issues. I do not know how to

    Download Cracked Pro Softwares
    But thankfully, I recently visited a website named cracksoftwarefreedownload
    All Pro Cracked Softwares Download
    PCexe.org
    Windows 12 Pro Crack
    Adobe Photoshop Lightroom CC crack
    Program4pc Video Converter Pro crack
    Advanced Installer Architect Crack

    ReplyDelete
  12. I guess I am the only one who came here to share my very own experience. Guess what!? I am using my laptop for almost the past 2 years, but I had no idea of solving some basic issues. I do not know how to Crack Softwares Free Download But thankfully, I recently visited a website named ProCrackHere
    Netbalancer Crack
    Dragon Naturally Speaking Crack

    ReplyDelete
  13. I like your all post. You have done really good work. Thank you for the information you provide, it helped me a lot. I hope to have many more entries or so from you.
    Very interesting blog.
    Panda Antivirus Pro Crack
    Lansweeper Crack
    UltraEdit Crack
    EaseUS Data Recovery Wizard Crack
    Glary Utilities Pro Crack
    Ashampoo Photo Recovery Crack
    Recover My Files Crack
    CyberGhost VPN Crack

    ReplyDelete
  14. Pretty great post. I simply stumbled upon your blog and wanted to mention that I have really loved surfing around your blog posts. Great set of tips from the master himself. Excellent ideas. Thanks for Awesome tips Keep it up
    Ant Download Manager Pro Crack
    ascrack.org

    ReplyDelete