Skip to content

Snappy1

  • Home
  • Android
  • What
  • How
  • Is
  • Can
  • Does
  • Do
  • Why
  • Are
  • Who
  • Toggle search form

[FIXED] android – How to lock device orientation for React Native

Posted on November 11, 2022 By

Solution 1 :

For Android

For Android platform all we need to do is navigate to AndroidManifest.xml file that lies inside android/app/src/main path and add the property android:screenOrientation with a value or portrait or landscape respectively. The property has to be added in xml element activity which is a child of application element.

Simply add it as shown below:

enter image description here

For iOS

For iOS platform we need to open Xcode, and select the desired orientation modes from the Device Orientation section. As shown below:

  1. Load the iOS part of your React Native project
  2. Navigate to tab General from the horizontal menu
  3. Go to down to Deployment Info section and check/uncheck the desired device orientation modes.

enter image description here

And you are set! Rebuild your project to verify that the changes are configured.

Problem :

Hi I want to know how to lock device orientation for React Native for both android and iOS. I need to lock the orientation once user rotate the device and application will lock with portrait or lanscape

Comments

Comment posted by npmjs.com/package/react-native-orientation-locker

Try this package

Comment posted by Akila Devinda

@DeSilva glad it helps

READ  [FIXED] kotlin - How do I close App on Back button press in an Activity which is not the launcher activity in android?
Powered by Inline Related Posts
Android Tags:android, ios, react-native, reactjs

Post navigation

Previous Post: [FIXED] android – How to pass data by Back Button, Kotlin
Next Post: [FIXED] Project with external module issue in android studio 3.6

Related Posts

[FIXED] java – How to Save the last Fragment? Android
[FIXED] android studio – Is it possible to share my position to another device (secured)? Android
[FIXED] android – Why not cast to MutableList since I set .toMutableList() Android
[FIXED] What does ‘view’ container do in XML of Android Android
[FIXED] java – I get an error when running an android studio app which used to run perfectly Android
[FIXED] Is there any way to initialize an array of text views in java android studio Android

Archives

  • March 2023
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022

Categories

  • ¿Cómo
  • ¿Cuál
  • ¿Cuándo
  • ¿Cuántas
  • ¿Cuánto
  • ¿Qué
  • Android
  • Are
  • At
  • C'est
  • Can
  • Comment
  • Did
  • Do
  • Does
  • Est-ce
  • Est-il
  • For
  • Has
  • Hat
  • How
  • In
  • Is
  • Ist
  • Kann
  • Où
  • Pourquoi
  • Quand
  • Quel
  • Quelle
  • Quelles
  • Quels
  • Qui
  • Should
  • Sind
  • Sollte
  • Uncategorized
  • Wann
  • Warum
  • Was
  • Welche
  • Welchen
  • Welcher
  • Welches
  • Were
  • What
  • What's
  • When
  • Where
  • Which
  • Who
  • Who's
  • Why
  • Wie
  • Will
  • Wird
  • Wo
  • Woher
  • you can create a selvedge edge: You can make the edges of garter stitch more smooth by slipping the first stitch of every row.2022-02-04
  • you really only need to know two patterns: garter stitch

Recent Posts

  • What are the main features of Islamic education?
  • Is the Jeep 4xe worth it?
  • How does the ringer work on cast iron?
  • What is the biggest size interior door?
  • Is blue raspberry an original Jolly Rancher flavor?

Recent Comments

No comments to show.

Copyright © 2023 Snappy1.

Powered by PressBook Grid Dark theme