Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
900 views
in Technique[技术] by (71.8m points)

react native - How to set Expo Web ScreenOrientation "landscape"?

I developed a mobile Expo React Native App and I need to build a web version. When I try to run the app on web, I noticed that the components are rendering "rotated". That is, the width is the height and vice versa. I can't just switch the values due to large amount of components and flex styling. By checking web orientation it's say that is "portrait" and the app default orientation is "landscape", that's explain the problem.

According to Expo Orientation Documentation, I should be able to "rotate" the web screen with:

ScreenOrientation.lockPlatformAsync(ScreenOrientation.WebOrientationLock.LANDSCAPE);

But I got this error:

TypeError: lockPlatformAsync cannot be called with undefined option properties

I also tryied to change app.json "orientation" value to "landscape", but this also doesn't worked.

Any suggestions?

question from:https://stackoverflow.com/questions/65854918/how-to-set-expo-web-screenorientation-landscape

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share

2.1m questions

2.1m answers

62 comments

56.6k users

...