Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.9k 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?


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

1 Answer

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...