Disable landscape orientation in react app - javascript

I am building an app with reactJS. I am using webpack,sass and ajax for running the app and fetching data. I am in search of a function/logic where i can disable the landscape view. I want my app to be available only in portrait view and even if the user rotates it's phone, in the landscape view the app should not get resized.
I am finding solutions where there are options to customise this using tools. I need a solution where i can add this option similar to adding javascript code.

Related

How to render a mobile screen with mobile app running on desktop browser?

I want to create a web app such as this?
I already have a mobile app how do I display my mobile app like this on the large screens?
On large screens, I want a mobile and then mobile app running within it.
This is the link for the website shown in image
I want my Website to work like this, how can I achieve it?
I already have an mobile app made using ionic, what i want is to use that app for large screens like this website has used.
I'm not sure if I understand what you're asking.
To make responsive websites, you should use this:
#media (min-width: Xpx) {
}
You can define your minimum width here, that indicates the size of browser at which these settings should be applied. If you're using sass, nest this and apply your browser-sized settings there.
I hope that was helpful, but maybe I misunderstood the question and it's more complicated
I don't have any experience of this problem but there is a dedicated article here: https://ionicframework.com/blog/tips-tricks-for-ionic-on-desktop/
This can be created by using an Iframe on the Desktop.
So I created an SVG for the borders of the mobile and rendered my app inside the SVG using the Iframe.
Since I am using Iframe so my app takes mobile width as viewport width and is rendered as it should on mobile.

Rotate 1 screen in React native (both ios and android)

I'm coding an application React-Native in which i need one screen to be locked on landscape (without any action from the user), how can i do this ?
I tried the "transform" props but couldn't manage to make it works
In Android :
Navigate to the AndroidManifest.xml file. the path is android/app/src/main and set android:screenOrientation to the landscape.
In iOS:
Open iOS folder of your project with Xcode. In general tab, find device orientation and set it to landscape left or right.
The abovementioned is ok to change the orientation of all the screens. if you need to change one particular page only, you can use this library.

Hybrid Mobile App Development Images

Just want to ask, if how do you handle images for multiple dpi screen. Are you creating multiple image to support different screen resolution. By the way Im about to use Onsen UI Framework.
Thanks!

reload web app on orientation change

Simple problem. I have tried different search phrases. The most recent I tried is "reload web app on orientation change"
I KNOW or DEEPLY SUSPECT someone(s) have asked this question before on Stackoverflow but the search results do not answer my simple question.
1) I have a web site that renders fine on a smart phone when holding the phone in landscape view, until...
2) I re-orient the smartphone to a 'portrait' view position, where the phone is in the normal position with the long height of the phone is vertical
Then the web page is not using the whole screen. The page stays the exact same height as it was with the phone held 'sideways' in landscape mode. What I see is the page only using the top 2/5ths of the smartphone screen.
When I manually reload the page, the web page then completely fills the entire height of the screen.
I've added this and it changed nothing:
<meta name="viewport" content="height = [pixel_value | 'device-height'],
width = [pixel_value | 'device-width']" />
I prefer forcing a page reload or something ?? in javascript when the smart phone's orientation changes.
Because I know for a fact that when I reload the page after rotating the smart phone from landscape to portrait, then (and only then) will my web page use the whole height of the smart phone's screen.
I'm using only pure javascript.
How to reload my web pages in my web app when the smart phone's orientation is changed from landscape to portrait?
This is a very unsophisticated solution you are after but,
$( window ).resize(function() {
window.location.reload();
});
is a robust way to refresh the page when the user changes the orientation.
You can also use
screen.addEventListener("orientationchange", function() {
window.location.reload();
});
Generally you should make sure you write correct HTML/CSS if you want your webpage to be responsive is such settings instead of reverting to this kind of crude solutions

Camera orientation issues on phonegap iPhone development

I'm using phonegap in order to capture an image in my application.
My application is configured to work in landscape orientation mode, with the button on the right.
The thing is that I need to keep that orientation when taking a photo with the camera.
I'm using the 1.4.1 version of the phonegap library. I have tried passing "correctOrientation: true" as a cameraOption parameter when calling capturePhoto(), but it doesn't seem to work and the device continues taking and storing the images as the device accelerometer tells.
Any idea how to solve it?

Categories