Locking to Portrait on app launching rotates from Landscape to Portrait (iOS)
up vote
1
down vote
favorite
I want to lock the orientation of the first screen of the app to portrait. In some screens, I need landscape orientation. I am using the react-native-orientation plugin. But when I launch the application, I see landscape orientation for a while and then quickly rotating to portrait orientation. The next screens are ok.
Here is my code:
componentDidMount()
Orientation.lockToPortrait();
Is it possible to solve this performance issue?
ios react-native
|
show 3 more comments
up vote
1
down vote
favorite
I want to lock the orientation of the first screen of the app to portrait. In some screens, I need landscape orientation. I am using the react-native-orientation plugin. But when I launch the application, I see landscape orientation for a while and then quickly rotating to portrait orientation. The next screens are ok.
Here is my code:
componentDidMount()
Orientation.lockToPortrait();
Is it possible to solve this performance issue?
ios react-native
do you want to disable the landscape orientation for all screens in your app?
– Nino9612
yesterday
@Nino9612 No, in some screens I need landscape orientation.
– Vladimír
yesterday
hmm okay. For which platforms are you developing?
– Nino9612
yesterday
@Nino9612 For iOS and Android. But this problem is only in iOS.
– Vladimír
yesterday
Have you triedOrientation.lockToPortrait()
outside of component lifecycle method may be atapp.js
?
– Prasun
yesterday
|
show 3 more comments
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I want to lock the orientation of the first screen of the app to portrait. In some screens, I need landscape orientation. I am using the react-native-orientation plugin. But when I launch the application, I see landscape orientation for a while and then quickly rotating to portrait orientation. The next screens are ok.
Here is my code:
componentDidMount()
Orientation.lockToPortrait();
Is it possible to solve this performance issue?
ios react-native
I want to lock the orientation of the first screen of the app to portrait. In some screens, I need landscape orientation. I am using the react-native-orientation plugin. But when I launch the application, I see landscape orientation for a while and then quickly rotating to portrait orientation. The next screens are ok.
Here is my code:
componentDidMount()
Orientation.lockToPortrait();
Is it possible to solve this performance issue?
ios react-native
ios react-native
edited 17 hours ago
Hannes
2,70822941
2,70822941
asked yesterday
Vladimír
10110
10110
do you want to disable the landscape orientation for all screens in your app?
– Nino9612
yesterday
@Nino9612 No, in some screens I need landscape orientation.
– Vladimír
yesterday
hmm okay. For which platforms are you developing?
– Nino9612
yesterday
@Nino9612 For iOS and Android. But this problem is only in iOS.
– Vladimír
yesterday
Have you triedOrientation.lockToPortrait()
outside of component lifecycle method may be atapp.js
?
– Prasun
yesterday
|
show 3 more comments
do you want to disable the landscape orientation for all screens in your app?
– Nino9612
yesterday
@Nino9612 No, in some screens I need landscape orientation.
– Vladimír
yesterday
hmm okay. For which platforms are you developing?
– Nino9612
yesterday
@Nino9612 For iOS and Android. But this problem is only in iOS.
– Vladimír
yesterday
Have you triedOrientation.lockToPortrait()
outside of component lifecycle method may be atapp.js
?
– Prasun
yesterday
do you want to disable the landscape orientation for all screens in your app?
– Nino9612
yesterday
do you want to disable the landscape orientation for all screens in your app?
– Nino9612
yesterday
@Nino9612 No, in some screens I need landscape orientation.
– Vladimír
yesterday
@Nino9612 No, in some screens I need landscape orientation.
– Vladimír
yesterday
hmm okay. For which platforms are you developing?
– Nino9612
yesterday
hmm okay. For which platforms are you developing?
– Nino9612
yesterday
@Nino9612 For iOS and Android. But this problem is only in iOS.
– Vladimír
yesterday
@Nino9612 For iOS and Android. But this problem is only in iOS.
– Vladimír
yesterday
Have you tried
Orientation.lockToPortrait()
outside of component lifecycle method may be at app.js
?– Prasun
yesterday
Have you tried
Orientation.lockToPortrait()
outside of component lifecycle method may be at app.js
?– Prasun
yesterday
|
show 3 more comments
2 Answers
2
active
oldest
votes
up vote
1
down vote
Add below code in your page where orientation lock is delayed:
componentWillMount()
Orientation.lockToPortrait();
Orientation.addOrientationListener(this._orientationDidChange);
_orientationDidChange(orientation)
Orientation.lockToPortrait();
componentWillUnmount()
// remove listener
Orientation.removeOrientationListener(this._orientationDidChange);
It didn't help.
– Vladimír
14 hours ago
add a comment |
up vote
0
down vote
react-native-orientation no longer seems maintained.
I encourage you to use react-native-orientation-locker which also provides Orientation.lockToPortrait()
Result is the same as with react-native-orientation.
– Vladimír
yesterday
what is your device ? what is your OS version number ?
– Julien Malige
23 hours ago
My device is iPhone SE. iOS 12.0.1.
– Vladimír
23 hours ago
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
Add below code in your page where orientation lock is delayed:
componentWillMount()
Orientation.lockToPortrait();
Orientation.addOrientationListener(this._orientationDidChange);
_orientationDidChange(orientation)
Orientation.lockToPortrait();
componentWillUnmount()
// remove listener
Orientation.removeOrientationListener(this._orientationDidChange);
It didn't help.
– Vladimír
14 hours ago
add a comment |
up vote
1
down vote
Add below code in your page where orientation lock is delayed:
componentWillMount()
Orientation.lockToPortrait();
Orientation.addOrientationListener(this._orientationDidChange);
_orientationDidChange(orientation)
Orientation.lockToPortrait();
componentWillUnmount()
// remove listener
Orientation.removeOrientationListener(this._orientationDidChange);
It didn't help.
– Vladimír
14 hours ago
add a comment |
up vote
1
down vote
up vote
1
down vote
Add below code in your page where orientation lock is delayed:
componentWillMount()
Orientation.lockToPortrait();
Orientation.addOrientationListener(this._orientationDidChange);
_orientationDidChange(orientation)
Orientation.lockToPortrait();
componentWillUnmount()
// remove listener
Orientation.removeOrientationListener(this._orientationDidChange);
Add below code in your page where orientation lock is delayed:
componentWillMount()
Orientation.lockToPortrait();
Orientation.addOrientationListener(this._orientationDidChange);
_orientationDidChange(orientation)
Orientation.lockToPortrait();
componentWillUnmount()
// remove listener
Orientation.removeOrientationListener(this._orientationDidChange);
answered 18 hours ago
Sandy
1,3821520
1,3821520
It didn't help.
– Vladimír
14 hours ago
add a comment |
It didn't help.
– Vladimír
14 hours ago
It didn't help.
– Vladimír
14 hours ago
It didn't help.
– Vladimír
14 hours ago
add a comment |
up vote
0
down vote
react-native-orientation no longer seems maintained.
I encourage you to use react-native-orientation-locker which also provides Orientation.lockToPortrait()
Result is the same as with react-native-orientation.
– Vladimír
yesterday
what is your device ? what is your OS version number ?
– Julien Malige
23 hours ago
My device is iPhone SE. iOS 12.0.1.
– Vladimír
23 hours ago
add a comment |
up vote
0
down vote
react-native-orientation no longer seems maintained.
I encourage you to use react-native-orientation-locker which also provides Orientation.lockToPortrait()
Result is the same as with react-native-orientation.
– Vladimír
yesterday
what is your device ? what is your OS version number ?
– Julien Malige
23 hours ago
My device is iPhone SE. iOS 12.0.1.
– Vladimír
23 hours ago
add a comment |
up vote
0
down vote
up vote
0
down vote
react-native-orientation no longer seems maintained.
I encourage you to use react-native-orientation-locker which also provides Orientation.lockToPortrait()
react-native-orientation no longer seems maintained.
I encourage you to use react-native-orientation-locker which also provides Orientation.lockToPortrait()
edited yesterday
answered yesterday
Julien Malige
840723
840723
Result is the same as with react-native-orientation.
– Vladimír
yesterday
what is your device ? what is your OS version number ?
– Julien Malige
23 hours ago
My device is iPhone SE. iOS 12.0.1.
– Vladimír
23 hours ago
add a comment |
Result is the same as with react-native-orientation.
– Vladimír
yesterday
what is your device ? what is your OS version number ?
– Julien Malige
23 hours ago
My device is iPhone SE. iOS 12.0.1.
– Vladimír
23 hours ago
Result is the same as with react-native-orientation.
– Vladimír
yesterday
Result is the same as with react-native-orientation.
– Vladimír
yesterday
what is your device ? what is your OS version number ?
– Julien Malige
23 hours ago
what is your device ? what is your OS version number ?
– Julien Malige
23 hours ago
My device is iPhone SE. iOS 12.0.1.
– Vladimír
23 hours ago
My device is iPhone SE. iOS 12.0.1.
– Vladimír
23 hours ago
add a comment |
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53222179%2flocking-to-portrait-on-app-launching-rotates-from-landscape-to-portrait-ios%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
do you want to disable the landscape orientation for all screens in your app?
– Nino9612
yesterday
@Nino9612 No, in some screens I need landscape orientation.
– Vladimír
yesterday
hmm okay. For which platforms are you developing?
– Nino9612
yesterday
@Nino9612 For iOS and Android. But this problem is only in iOS.
– Vladimír
yesterday
Have you tried
Orientation.lockToPortrait()
outside of component lifecycle method may be atapp.js
?– Prasun
yesterday