I had locked my react application to landscape by adding the following code to Application tag(in Manifest) and inside every activities tag
android:screenOrientation="landscape"
android:configChanges="keyboard|keyboardHidden|screenSize
It was working fine, until i added the modules for file reading react-native-fs
Now when the app starts the screen is rotated to landscape, but if the user rotates the phone to portrait, the screen also rotates to portrait (it should remain in landscape instead).
Things i tried
Added android:screenOrientation="landscape" in the manifest of modules.
In MainApplication registered registerActivityLifecycleCallbacks and added activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); in onActivityCreated.
Still it's not locked to landscape.
The app should be locked to landscape even if rotated to portrait.
I'm not completely sure, but I think you need to use android:configChanges="keyboardHidden|orientation|screenSize"
I figured out the problem. The React-Native-Navigation library was causing the issue.
It had a class ActivityCallBacks inside Controller package . Adding the following code inside onActivityCreated() resolved the issue :
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
Related
My application supports Portrait Mode in some pages and Landscape Mode in others, so in the case of the IOS version of the application I have Portrait, Landscape Left and Landscape Right turned on but restricted in the View Controllers. I have noticed however that during startup of the application when the Splash Screen is displayed it allows rotation. Wondering if the only way around this is to include additional assets for the Landscape version of the Splash Screen image.
Using Worklight 6.2 and Cordova 3.4.1
I did not notice the application rotating while the splash screen is displayed, ... but anyway, you can solve this in 2 ways:
As your wrote - provide "proper" splash images, but I think that would still be odd looking. Or
Create a custom splash screen behavior; basically implement the Objective-C code that will disallow the rotation during the initialization stage of the application.
For this, you can read the following documents:
Common UI controls training module, starting slide #29
Managing the splash screen user documentation topic
I need some help regarding "Screen Rotation". I am creating this application in Landscape mode but I also want to be able to turn the iPad to Portrait mode. I am trying something different and making the application inside the viewcontroller. Basically copy and paste a view controller over and over. My issue is that even after I select, "Portrait" to be the ViewControllers Mode it still changed to landscape when i the iPad is turned to Landscape mode. I hope this made sense. Any answers are greatly appreciated!
If you're setting the supported orientation modes under the 'Deployment Info' section of your project file in Xcode, might be worth double checking that you are setting the modes for iPad rather than iPhone if you setup your project as a Universal app.
On iPhone and iPad I successfully added icon (project should contain square images icon.png and logo.png), and corrected LoginView.xib and LoginView-iPad.xib, so icon is shown in top of the screen.
But I discover that in landscape mode on iPad not only icon, but also login/psw fields are placed out of the screen. How i can change xib for authorization?
The xib for authentication can be completely customized, and since the source code is open source, it can be modified as well. Having said that, landscape support should be built in. You can track this issue on GitHub.
Nowadays, I am working on a iOS project formed with Phonegap 2.0 and jQuery Mobile 1.1.1 and I am having a serious issue with orientation changes.
The problem is the screen size proportions after the orientation changes that you make during loading.
After loading completes orientation works without any problem if I didn't change the orientation during loading.
If I change the orientation during the launch/loading of the application than it starts acting weird! like giving white spaces near the screen etc. Orientation is completely start acting weird from that point which pushes me to restart the app.
Did some one face the same problem?
I haven't done anything funky with my code, and am running the latest version of XCode, but for some reason when I run a build on the simulator, everything works perfectly except for the fact that it's upside down. Any idea why that could be the case?
Thanks in advance.
I had (have) this problem also. At first I though I found it when I created a fresh app and compared the Info.plist and discovered my app had the Supported Device Orientations different from the fresh app.
Specifically, I had Portrait Top above Portrait Bottom. After I put the Portrait Bottom at the head of the list the problem disappeared.
Or so I thought. I reorganized the main folder and put all the PNG files into a Resources folder. Deleted the old references in the project and add in the new locations and now the problem is back.
Also, noted the problem is occuring on the actual iOS device. You can see in this launch pix the status bar and picture are both upside down. As soon as my mainView loads the view orients correctly and becomes upright in the Portrait Top orientation.
[Picture of the launch1
There has to be something about the project file that is causing this. Still searching.
Looking around I found [this2 which states the order is important and the top most is the inital view. So now I am really puzzled as the Portrait Bottom is at the head of the list.
This happened to me too today. Easiest temporary fix is to look at your target's "Supported Device Orientations" on the "Summary" tab. My guess is that both "Portrait" and "Upside Down" are selected.
For some reason my XCode was defaulting to "Upside Down" and deselecting that orientation made the problem go away.
Found the solution!
Evidently there is a bug in Interface Builder. If you simply click off all the orientations, then click them back on in the desired order the Info.plist is built correctly.