gpt4 book ai didi

reactjs - 如何在 react 导航中将屏幕方向锁定为纵向模式?

转载 作者:行者123 更新时间:2023-12-02 00:55:50 24 4
gpt4 key购买 nike

如何在React Navigation中将屏幕模式锁定为纵向模式?

我使用的 React 导航版本:4.0.10

这是我的导航结构

const AppNavigation = createSwitchNavigator({
Initialize: {
//screen: SplashScreen,
screen: Login,
},
ApplicationIntro: {
screen: ApplicationIntro,
navigationOptions: {
header: null,
},
},
Auth: AuthNavigation,
Home: Home,
});

文档中没有任何关于通过 navigationOptionsdefaultNavigationOptions 传递参数来处理屏幕方向的内容。

有没有办法在不使用任何其他库的情况下将屏幕模式锁定为“肖像”?

最佳答案

设置方向纵向模式的最简单方法之一,将这段代码android:screenOrientation="portrait"添加到android list 文件中的事件标记中,就像这样

在 list 中,为您的所有事件进行设置:

<activity android:name=".YourActivity"
android:configChanges="orientation"
android:screenOrientation="portrait"/>

关于reactjs - 如何在 react 导航中将屏幕方向锁定为纵向模式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59019587/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com